Skip to content

Commit

Permalink
fix: panic error contains servicename (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY authored Dec 5, 2023
1 parent 4b32979 commit dfefcbf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pbrpc/failedcall/error_handler/errhandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func TestHandlerPanic(t *testing.T) {
de := err.(*kerrors.DetailedError)
// wrap error is kerrors.ErrRemoteOrNetwork
test.Assert(t, de.ErrorType() == kerrors.ErrRemoteOrNetwork)
test.Assert(t, strings.Contains(err.Error(), "remote or network error[remote]: panic: [happened in biz handler, method=testSTReq] mock handler panic"), err.Error())
test.Assert(t, strings.Contains(err.Error(), "happened in biz handler"), err.Error())
// internal is *remote.TransError
te := de.Unwrap().(*remote.TransError)
test.Assert(t, te.TypeID() == remote.InternalError)
Expand All @@ -212,7 +212,7 @@ func TestHandlerPanic(t *testing.T) {
de = err.(*kerrors.DetailedError)
// wrap error is kerrors.ErrRemoteOrNetwork
test.Assert(t, de.ErrorType() == kerrors.ErrRemoteOrNetwork)
test.Assert(t, strings.Contains(err.Error(), "remote or network error: rpc error: code = 13 desc = panic: [happened in biz handler, method=testSTReq] mock handler panic"), err.Error())
test.Assert(t, strings.Contains(err.Error(), "happened in biz handler"), err.Error())
// internal is *status.Error
se, ok := status.FromError(err)
test.Assert(t, ok)
Expand Down
2 changes: 1 addition & 1 deletion thriftrpc/failedcall/error_handler/errhandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestHandlerPanic(t *testing.T) {
de := err.(*kerrors.DetailedError)
// wrap error is kerrors.ErrRemoteOrNetwork
test.Assert(t, de.ErrorType() == kerrors.ErrRemoteOrNetwork)
test.Assert(t, strings.Contains(err.Error(), "remote or network error[remote]: panic: [happened in biz handler, method=testSTReq] mock handler panic"), err.Error())
test.Assert(t, strings.Contains(err.Error(), "happened in biz handler"), err.Error())
// internal is *remote.TransError
te := de.Unwrap().(*remote.TransError)
test.Assert(t, te.TypeID() == remote.InternalError)
Expand Down
2 changes: 1 addition & 1 deletion thriftrpc/failedmux/error_handler/errhandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestHandlerPanic(t *testing.T) {
de := err.(*kerrors.DetailedError)
// wrap error is kerrors.ErrRemoteOrNetwork
test.Assert(t, de.ErrorType() == kerrors.ErrRemoteOrNetwork)
test.Assert(t, strings.Contains(err.Error(), "remote or network error[remote]: panic: [happened in biz handler, method=testSTReq] mock handler panic"), err.Error())
test.Assert(t, strings.Contains(err.Error(), "happened in biz handler"), err.Error())
// internal is *remote.TransError
te := de.Unwrap().(*remote.TransError)
test.Assert(t, te.TypeID() == remote.InternalError)
Expand Down

0 comments on commit dfefcbf

Please sign in to comment.