Skip to content

Commit

Permalink
Merge pull request #363 from davidblnc/main
Browse files Browse the repository at this point in the history
Replace references to Error type with Error code
  • Loading branch information
wmatveyenko authored Aug 22, 2022
2 parents df85b6f + a42f52b commit da0d7f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ One exception to this is that names match the proto names, this is considered mo

Errors returned by Twirp servers use non-200 HTTP status codes and always have
JSON-encoded bodies (even if the request was Protobuf-encoded). The body JSON
has three fields `{type, msg, meta}`. For example:
has three fields `{code, msg, meta}`. For example:

```
POST /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE
404 Not Found
{
"type": "bad_route",
"code": "bad_route",
"msg": "no handler for path /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE",
"meta": {"twirp_invalid_route": "POST /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE"}
}
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type Error interface {
// MetaMap returns the complete key-value metadata map stored on the error.
MetaMap() map[string]string

// Error returns a string of the form "twirp error <Type>: <Msg>"
// Error returns a string of the form "twirp error <Code>: <Msg>"
Error() string
}

Expand Down

0 comments on commit da0d7f5

Please sign in to comment.