Skip to content

Commit

Permalink
Merge pull request #20 from risingwavelabs/junfeng/fixit20230630
Browse files Browse the repository at this point in the history
fix: start code from 0
  • Loading branch information
wjf3121 authored Jun 30, 2023
2 parents 4f2f5b9 + 7cac006 commit 714d5f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Code int
// These are common impact error codes that are found throughout our services.
const (
// The operation was cancelled, typically by the caller.
CodeCanceled Code = iota
CodeCanceled Code = iota + 1
// Unknown error. For example, this error may be returned when a Status value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error.
CodeUnknown
// The client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name).
Expand Down
4 changes: 2 additions & 2 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestFormatStr(t *testing.T) {
},
"external error": {
input: errors.New("external error"),
output: "code(canceled) external error",
output: "code(unknown) external error",
},
// This is the expected behavior, since this error does not hold any information
"empty error": {
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestInvertedFormatStr(t *testing.T) {
},
"external error": {
input: errors.New("external error"),
output: "external error code(canceled) ",
output: "external error code(unknown) ",
},
"empty wrapped external error": {
input: eris.WithCode(eris.Wrap(errors.New("some err"), "additional context"), eris.CodeUnknown),
Expand Down

0 comments on commit 714d5f1

Please sign in to comment.