Skip to content

Commit

Permalink
Merge pull request #1027 from tamird/stringify-codes
Browse files Browse the repository at this point in the history
Use codes.Code.String() rather than logging integers
  • Loading branch information
menghanl authored Feb 28, 2017
2 parents d122f1d + 9871e09 commit aefc96d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rpc_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ type rpcError struct {
}

func (e *rpcError) Error() string {
return fmt.Sprintf("rpc error: code = %d desc = %s", e.code, e.desc)
return fmt.Sprintf("rpc error: code = %s desc = %s", e.code, e.desc)
}

// Code returns the error code for err if it was produced by the rpc system.
Expand Down
2 changes: 1 addition & 1 deletion transport/handler_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) {
},
RequestURI: "/service/foo.bar",
},
wantErr: `stream error: code = 13 desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`,
wantErr: `stream error: code = Internal desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`,
},
{
name: "with metadata",
Expand Down
2 changes: 1 addition & 1 deletion transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ type StreamError struct {
}

func (e StreamError) Error() string {
return fmt.Sprintf("stream error: code = %d desc = %q", e.Code, e.Desc)
return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc)
}

// ContextErr converts the error from context package into a StreamError.
Expand Down

0 comments on commit aefc96d

Please sign in to comment.