Only push net error to c.Errors and panic others errors

This commit is contained in:
chenyahui 2023-04-28 16:09:50 +08:00
parent eac2daac64
commit cc62cdfffc

View File

@ -924,9 +924,13 @@ 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 {
// Pushing error to c.Errors // if err is net error, pushing error to c.Errors
if _, ok := err.(*net.OpError); ok {
_ = c.Error(err) _ = c.Error(err)
c.Abort() c.Abort()
} else {
panic(err)
}
} }
} }