-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I'm experiencing double calling of HTTPErrorHandler by lecho middleware logger.
First it's called if there was error during request processing, immediately when request is returned from middleware chain:
Lines 84 to 86 in 6b6fa8f
| if err = next(c); err != nil { | |
| c.Error(err) | |
| } |
Next request log is produced and sent, but the middleware returns the same error again up:
Line 126 in 6b6fa8f
| return err |
This causes the error to be propagated up the chain and is again sent to HTTPErrorHandler function by echo itself:
https://github.com/labstack/echo/blob/4a1ccdfdc520eb90573a97a7d04fd9fc300c1629/echo.go#L619-L631
The "native" echo Logger middleware does not do this, the error is consumed by calling handler immediately (the same as lecho) and then error sent up the middleware chain is actual result (error) of writing the log.
Do I understand something wrongly (ie is this expected behavior and i'm supposed to somehow catch the error) or is this actual bug?