Skip to content

refactor: unify the error handling methods that are different from the project style #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions x/feeds/types/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

import "fmt"
import "errors"

// AbsInt64 returns an absolute of int64.
// Panics on min int64 (-9223372036854775808).
Expand All @@ -15,7 +15,7 @@ func AbsInt64(x int64) int64 {
// StringToBytes32 converts a string to a fixed size byte array.
func StringToBytes32(str string) ([32]byte, error) {
if len(str) > 32 {
return [32]byte{}, fmt.Errorf("string is too long")
return [32]byte{}, errors.New("string is too long")
}

var byteArray [32]byte
Expand Down
4 changes: 2 additions & 2 deletions x/tss/testutil/util.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package testutil

import (
"fmt"
"errors"
"math/rand"
"time"

Expand Down Expand Up @@ -57,7 +57,7 @@ func GenerateSignature(
}

if member.MemberID == 0 {
return nil, fmt.Errorf("member not found")
return nil, errors.New("member not found")
}

// Compute own private nonce
Expand Down
3 changes: 2 additions & 1 deletion yoda/executor/multi.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package executor

import (
"errors"
"fmt"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (e *MultiExec) Exec(code []byte, arg string, env interface{}) (ExecResult,
errs := []error{}
for _, each := range e.nextExecOrder() {
res, err := each.Exec(code, arg, env)
if err == nil || err == ErrExecutionimeout {
if err == nil || errors.Is(err, ErrExecutionimeout) {
return res, err
} else {
errs = append(errs, err)
Expand Down