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

Map 422 Unprocessable Entity to INVALID_ARGUMENT #1149

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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