mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 06:46:26 +01:00
view: minor
This commit is contained in:
parent
52485480d8
commit
096349bb56
|
@ -33,7 +33,6 @@ import (
|
||||||
"github.com/fatih/structs"
|
"github.com/fatih/structs"
|
||||||
gojson "github.com/goccy/go-json"
|
gojson "github.com/goccy/go-json"
|
||||||
"github.com/iris-contrib/schema"
|
"github.com/iris-contrib/schema"
|
||||||
"github.com/kataras/golog"
|
|
||||||
"github.com/mailru/easyjson"
|
"github.com/mailru/easyjson"
|
||||||
"github.com/mailru/easyjson/jwriter"
|
"github.com/mailru/easyjson/jwriter"
|
||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
|
@ -3627,15 +3626,18 @@ func (ctx *Context) View(filename string, optionalViewModel ...interface{}) erro
|
||||||
ctx.ContentType(ContentHTMLHeaderValue)
|
ctx.ContentType(ContentHTMLHeaderValue)
|
||||||
|
|
||||||
err := ctx.renderView(filename, optionalViewModel...)
|
err := ctx.renderView(filename, optionalViewModel...)
|
||||||
if errNotExists, ok := err.(ErrViewNotExist); ok {
|
if err != nil {
|
||||||
err = ctx.fireFallbackViewOnce(errNotExists)
|
if errNotExists, ok := err.(ErrViewNotExist); ok {
|
||||||
|
err = ctx.fireFallbackViewOnce(errNotExists)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ctx.app.Logger().Level == golog.DebugLevel {
|
if ctx.IsDebug() {
|
||||||
// send the error back to the client, when debug mode.
|
// send the error back to the client, when debug mode.
|
||||||
ctx.StopWithError(http.StatusInternalServerError, err)
|
ctx.StopWithError(http.StatusInternalServerError, err)
|
||||||
} else {
|
} else {
|
||||||
|
ctx.SetErrPrivate(err)
|
||||||
ctx.StopWithStatus(http.StatusInternalServerError)
|
ctx.StopWithStatus(http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user