1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-27 22:38:25 +02:00

Recover middleware should not log panic for aborted handler (#2134, fixes #2133)

Co-authored-by: Becir Basic <bb@neotel.at>
This commit is contained in:
Becir Basic
2022-03-16 00:29:42 +01:00
committed by GitHub
parent 05df10c62f
commit 5c38c3b770
2 changed files with 33 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package middleware
import (
"fmt"
"net/http"
"runtime"
"github.com/labstack/echo/v4"
@@ -77,6 +78,9 @@ func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc {
defer func() {
if r := recover(); r != nil {
if r == http.ErrAbortHandler {
panic(r)
}
err, ok := r.(error)
if !ok {
err = fmt.Errorf("%v", r)