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

Function HandleAPIError

x/errors/errors.go:382–391  ·  view source on GitHub ↗

HandleAPIError handles remote server errors. Optionally, use it when you write your server's HTTP clients using the the /x/client package. When the HTTP Client sends data to a remote server but that remote server failed to accept the request as expected, then the error will be proxied to this server

(ctx *context.Context, err error)

Source from the content-addressed store, hash-verified

380// HTTP internal server error to the end-client and
381// prints the "err" using the "LogError" package-level function.
382func HandleAPIError(ctx *context.Context, err error) {
383 // Error expected and came from the external server,
384 // save its body so we can forward it to the end-client.
385 if apiErr, ok := client.GetError(err); ok {
386 handleAPIError(ctx, apiErr)
387 return
388 }
389
390 Internal.LogErr(ctx, err)
391}
392
393func handleAPIError(ctx *context.Context, apiErr client.APIError) {
394 // Error expected and came from the external server,

Callers

nothing calls this directly

Calls 3

GetErrorFunction · 0.92
handleAPIErrorFunction · 0.85
LogErrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…