MCPcopy Create free account
hub / github.com/DoNewsCode/core / TestServerError_CustomPrinter

Function TestServerError_CustomPrinter

unierr/error_test.go:50–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestServerError_CustomPrinter(t *testing.T) {
51 testError := &Error{
52 err: errors.New("err"),
53 msg: "foo",
54 code: codes.Aborted,
55 Printer: testPrinter{},
56 }
57 status := testError.GRPCStatus()
58 assert.Equal(t, codes.Aborted, status.Code())
59 assert.Equal(t, "FOO", status.Message())
60 bytes, err := testError.MarshalJSON()
61 assert.NoError(t, err)
62 assert.Equal(t, []byte(`{"code":10,"message":"FOO"}`), bytes)
63}
64
65func TestWrap(t *testing.T) {
66 type args struct {

Callers

nothing calls this directly

Calls 2

GRPCStatusMethod · 0.95
MarshalJSONMethod · 0.95

Tested by

no test coverage detected