MCPcopy Create free account
hub / github.com/kataras/iris / handleAPIError

Function handleAPIError

x/errors/errors.go:393–404  ·  view source on GitHub ↗
(ctx *context.Context, apiErr client.APIError)

Source from the content-addressed store, hash-verified

391}
392
393func 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
406func handleJSONError(ctx *context.Context, err error) bool {
407 var syntaxErr *json.SyntaxError

Callers 2

HandleErrorFunction · 0.85
HandleAPIErrorFunction · 0.85

Calls 2

DataWithDetailsMethod · 0.80
DataMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…