(ctx *context.Context, apiErr client.APIError)
| 391 | } |
| 392 | |
| 393 | func handleAPIError(ctx *context.Context, apiErr client.APIError) { |
| 394 | // Error expected and came from the external server, |
| 395 | // save its body so we can forward it to the end-client. |
| 396 | statusCode := apiErr.Response.StatusCode |
| 397 | if statusCode >= 400 && statusCode < 500 { |
| 398 | InvalidArgument.DataWithDetails(ctx, "remote server error", "invalid client request", apiErr.Body) |
| 399 | } else { |
| 400 | Internal.Data(ctx, "remote server error", apiErr.Body) |
| 401 | } |
| 402 | |
| 403 | // Unavailable.DataWithDetails(ctx, "remote server error", "unavailable", apiErr.Body) |
| 404 | } |
| 405 | |
| 406 | func handleJSONError(ctx *context.Context, err error) bool { |
| 407 | var syntaxErr *json.SyntaxError |
no test coverage detected
searching dependent graphs…