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{})
| 103 | // FailJSON will send to the client the error data as JSON. |
| 104 | // Useful for APIs. |
| 105 | func 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. |
no test coverage detected
searching dependent graphs…