diff --git a/errors/errors.go b/errors/errors.go index dd4850cba..4126d61be 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -38,7 +38,7 @@ func (e *Error) GRPCStatus() *status.Status { // Is matches each error in the chain with the target value. func (e *Error) Is(err error) bool { if se := new(Error); errors.As(err, &se) { - return se.Reason == e.Reason + return se.Code == e.Code && se.Reason == e.Reason } return false } diff --git a/errors/errors_test.go b/errors/errors_test.go index 8fae9eb54..4abf1cb0a 100644 --- a/errors/errors_test.go +++ b/errors/errors_test.go @@ -76,7 +76,7 @@ func TestIs(t *testing.T) { }{ { name: "true", - e: &Error{Reason: "test"}, + e: &Error{Code: 404, Reason: "test"}, err: New(http.StatusNotFound, "test", ""), want: true, },