forked from mirror/gin
The Recovery() middleware should not print the errors (only panics)
This commit is contained in:
parent
91df54a5c2
commit
fa80b047f9
|
@ -82,9 +82,6 @@ func function(pc uintptr) []byte {
|
||||||
func Recovery() HandlerFunc {
|
func Recovery() HandlerFunc {
|
||||||
return func(c *Context) {
|
return func(c *Context) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if len(c.Errors) > 0 {
|
|
||||||
log.Println(c.Errors.String())
|
|
||||||
}
|
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
stack := stack(3)
|
stack := stack(3)
|
||||||
log.Printf("PANIC: %s\n%s", err, stack)
|
log.Printf("PANIC: %s\n%s", err, stack)
|
||||||
|
|
Loading…
Reference in New Issue