Skip to content

Commit

Permalink
Add c.Response().Committed check in example customHTTPErrorHandler (#359
Browse files Browse the repository at this point in the history
)
  • Loading branch information
briskt authored Dec 8, 2024
1 parent 5d0291a commit ab6af18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/docs/guide/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ https://github.com/AndiDittrich/HttpErrorPages for pre-built error pages.

```go
func customHTTPErrorHandler(err error, c echo.Context) {
if c.Response().Committed {
return
}

code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok {
code = he.Code
Expand Down

0 comments on commit ab6af18

Please sign in to comment.