diff --git a/cerrors/cerrors.go b/cerrors/cerrors.go index 63e2b22..9b2db0d 100644 --- a/cerrors/cerrors.go +++ b/cerrors/cerrors.go @@ -21,6 +21,7 @@ const ( UnavailableErr ResourceExhaustedErr Canceled + AlreadyExists ) func (e ErrorCode) String() string { @@ -45,6 +46,8 @@ func (e ErrorCode) String() string { return "ResourceExhaustedErr" case Canceled: return "Canceled" + case AlreadyExists: + return "AlreadyExists" default: return "UnknownErr" } @@ -75,7 +78,8 @@ func defaultErrorLevel(code ErrorCode) ErrorLevel { ParameterErr, ResourceExhaustedErr, FailedPreconditionErr, - Canceled: + Canceled, + AlreadyExists: return ErrorLevelWarn case UnknownErr, UnimplementedErr, diff --git a/cerrors/cerrors_test.go b/cerrors/cerrors_test.go index 75a2126..b7eccf4 100644 --- a/cerrors/cerrors_test.go +++ b/cerrors/cerrors_test.go @@ -236,6 +236,13 @@ func Test_ErrorCode_String(t *testing.T) { }, want: "Canceled", }, + { + name: "AlreadyExists", + args: args{ + code: AlreadyExists, + }, + want: "AlreadyExists", + }, { name: "不正値", args: args{