Skip to content

Commit

Permalink
fix: cast error into echo.HTTPError
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Jun 14, 2024
1 parent 4c52b97 commit 068c855
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 @@ -128,7 +128,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 068c855

Please sign in to comment.