diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/middleware/recover.go')
-rw-r--r-- | vendor/github.com/labstack/echo/middleware/recover.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/vendor/github.com/labstack/echo/middleware/recover.go b/vendor/github.com/labstack/echo/middleware/recover.go index 96fa62c9..687a198a 100644 --- a/vendor/github.com/labstack/echo/middleware/recover.go +++ b/vendor/github.com/labstack/echo/middleware/recover.go @@ -5,7 +5,6 @@ import ( "runtime" "github.com/labstack/echo" - "github.com/labstack/gommon/color" ) type ( @@ -64,17 +63,14 @@ func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc { defer func() { if r := recover(); r != nil { - var err error - switch r := r.(type) { - case error: - err = r - default: + err, ok := r.(error) + if !ok { err = fmt.Errorf("%v", r) } stack := make([]byte, config.StackSize) length := runtime.Stack(stack, !config.DisableStackAll) if !config.DisablePrintStack { - c.Logger().Printf("[%s] %s %s\n", color.Red("PANIC RECOVER"), err, stack[:length]) + c.Logger().Printf("[PANIC RECOVER] %v %s\n", err, stack[:length]) } c.Error(err) } |