mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-30 06:26:37 +08:00
Only push net error to c.Errors and panic others errors
This commit is contained in:
parent
eac2daac64
commit
cc62cdfffc
10
context.go
10
context.go
@ -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
|
||||||
_ = c.Error(err)
|
if _, ok := err.(*net.OpError); ok {
|
||||||
c.Abort()
|
_ = c.Error(err)
|
||||||
|
c.Abort()
|
||||||
|
} else {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user