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

Function Fail

_examples/database/mongodb/httputil/error.go:95–101  ·  view source on GitHub ↗

Fail will send the status code, write the error's reason and return the HTTPError for further use, i.e logging, see `InternalServerError`.

(ctx iris.Context, statusCode int, err error, format string, args ...interface{})

Source from the content-addressed store, hash-verified

93// Fail will send the status code, write the error's reason
94// and return the HTTPError for further use, i.e logging, see `InternalServerError`.
95func Fail(ctx iris.Context, statusCode int, err error, format string, args ...interface{}) HTTPError {
96 httpErr := newError(statusCode, err, format, args...)
97 httpErr.writeHeaders(ctx)
98
99 ctx.WriteString(httpErr.Description)
100 return httpErr
101}
102
103// FailJSON will send to the client the error data as JSON.
104// Useful for APIs.

Callers 1

InternalServerErrorFunction · 0.85

Calls 3

writeHeadersMethod · 0.80
WriteStringMethod · 0.80
newErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…