1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 20:07:04 +00:00

minor changes to MVC, see HISTORY.md#Next for more

This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-08-21 20:11:14 +03:00
parent 79404f91c1
commit 9f53d15133
4 changed files with 43 additions and 4 deletions

View File

@@ -4213,6 +4213,9 @@ func (ctx *Context) handleContextError(err error) {
if errHandler := ctx.app.GetContextErrorHandler(); errHandler != nil {
errHandler.HandleContextError(ctx, err)
} else {
if ctx.IsDebug() {
ctx.app.Logger().Error(err)
}
ctx.StatusCode(http.StatusInternalServerError)
}
@@ -4258,8 +4261,8 @@ func (ctx *Context) JSON(v interface{}, opts ...JSON) (err error) {
}
if err = ctx.writeJSON(v, options); err != nil {
// if no options are given or OmitErrorHandler is true
// then do call the error handler (which may lead to a cycle).
// if no options are given or OmitErrorHandler is false
// then call the error handler (which may lead to a cycle if the error handler fails to write JSON too).
if !options.OmitErrorHandler {
ctx.handleContextError(err)
}