mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +08:00
Fixed error handling in context render
This commit is contained in:
parent
d0b7ad21ce
commit
9a45526592
@ -924,7 +924,8 @@ func (c *Context) Render(code int, r render.Render) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := r.Render(c.Writer); err != nil {
|
if err := r.Render(c.Writer); err != nil {
|
||||||
c.Error(err)
|
// Pushing error to c.Errors
|
||||||
|
_ = c.Error(err)
|
||||||
c.Abort()
|
c.Abort()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Render (JSON) writes data with custom ContentType.
|
// Render (JSON) writes data with custom ContentType.
|
||||||
func (r JSON) Render(w http.ResponseWriter) (err error) {
|
func (r JSON) Render(w http.ResponseWriter) error {
|
||||||
return WriteJSON(w, r.Data)
|
return WriteJSON(w, r.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user