Skip to content

Commit

Permalink
fix: cast error into echo.HTTPError (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
samber authored Jun 25, 2024
1 parent 1205207 commit 3e610bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ func NewWithConfig(logger *slog.Logger, config Config) echo.MiddlewareFunc {
err = next(c)

if err != nil {
c.Error(err)
if _, ok := err.(*echo.HTTPError); !ok {
err = echo.
NewHTTPError(http.StatusInternalServerError).
WithInternal(err)
}
}

status := res.Status
Expand Down

0 comments on commit 3e610bd

Please sign in to comment.