MCPcopy
hub / github.com/grpc/grpc-go / StatusErrEqual

Function StatusErrEqual

internal/testutils/status_equal.go:28–38  ·  view source on GitHub ↗

StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors and their underlying status protos are equal.

(err1, err2 error)

Source from the content-addressed store, hash-verified

26// StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors
27// and their underlying status protos are equal.
28func StatusErrEqual(err1, err2 error) bool {
29 status1, ok := status.FromError(err1)
30 if !ok {
31 return false
32 }
33 status2, ok := status.FromError(err2)
34 if !ok {
35 return false
36 }
37 return proto.Equal(status1.Proto(), status2.Proto())
38}

Callers 6

TestToRPCErrMethod · 0.92
testFailedEmptyUnaryFunction · 0.92
testDoneInfoFunction · 0.92
TestStatusDetailsMethod · 0.92
TestStatusErrEqualMethod · 0.85

Calls 3

FromErrorFunction · 0.92
ProtoMethod · 0.80
EqualMethod · 0.65

Tested by 6

TestToRPCErrMethod · 0.74
testFailedEmptyUnaryFunction · 0.74
testDoneInfoFunction · 0.74
TestStatusDetailsMethod · 0.74
TestStatusErrEqualMethod · 0.68