Skip to content
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

fix: start code from 0 #20

Merged
merged 1 commit into from
Jun 30, 2023
Merged
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
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