Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Map 422 Unprocessable Entity to INVALID_ARGUMENT (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwc authored and songy23 committed Jul 2, 2019
1 parent df42942 commit 19a9151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugin/ochttp/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ func TraceStatus(httpStatusCode int, statusLine string) trace.Status {
code = trace.StatusCodeCancelled
case http.StatusBadRequest:
code = trace.StatusCodeInvalidArgument
case http.StatusUnprocessableEntity:
code = trace.StatusCodeInvalidArgument
case http.StatusGatewayTimeout:
code = trace.StatusCodeDeadlineExceeded
case http.StatusNotFound:
Expand Down
3 changes: 3 additions & 0 deletions plugin/ochttp/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ func TestStatusUnitTest(t *testing.T) {
{204, trace.Status{Code: trace.StatusCodeOK, Message: `OK`}},
{100, trace.Status{Code: trace.StatusCodeUnknown, Message: `UNKNOWN`}},
{500, trace.Status{Code: trace.StatusCodeUnknown, Message: `UNKNOWN`}},
{400, trace.Status{Code: trace.StatusCodeInvalidArgument, Message: `INVALID_ARGUMENT`}},
{422, trace.Status{Code: trace.StatusCodeInvalidArgument, Message: `INVALID_ARGUMENT`}},
{499, trace.Status{Code: trace.StatusCodeCancelled, Message: `CANCELLED`}},
{404, trace.Status{Code: trace.StatusCodeNotFound, Message: `NOT_FOUND`}},
{600, trace.Status{Code: trace.StatusCodeUnknown, Message: `UNKNOWN`}},
{401, trace.Status{Code: trace.StatusCodeUnauthenticated, Message: `UNAUTHENTICATED`}},
Expand Down

0 comments on commit 19a9151

Please sign in to comment.