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

Function FailJSON

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

FailJSON will send to the client the error data as JSON. Useful for APIs.

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

Source from the content-addressed store, hash-verified

103// FailJSON will send to the client the error data as JSON.
104// Useful for APIs.
105func FailJSON(ctx iris.Context, statusCode int, err error, format string, args ...interface{}) HTTPError {
106 httpErr := newError(statusCode, err, format, args...)
107 httpErr.writeHeaders(ctx)
108
109 ctx.JSON(httpErr)
110
111 return httpErr
112}
113
114// InternalServerError logs to the server's terminal
115// and dispatches to the client the 500 Internal Server Error.

Callers 2

InternalServerErrorJSONFunction · 0.85
UnauthorizedJSONFunction · 0.85

Calls 3

writeHeadersMethod · 0.80
newErrorFunction · 0.70
JSONMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…