Skip to content

Commit ab6af18

Browse files
authored
Add c.Response().Committed check in example customHTTPErrorHandler (#359)
1 parent 5d0291a commit ab6af18

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

website/docs/guide/error-handling.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ https://github.com/AndiDittrich/HttpErrorPages for pre-built error pages.
6666

6767
```go
6868
func customHTTPErrorHandler(err error, c echo.Context) {
69+
if c.Response().Committed {
70+
return
71+
}
72+
6973
code := http.StatusInternalServerError
7074
if he, ok := err.(*echo.HTTPError); ok {
7175
code = he.Code

0 commit comments

Comments
 (0)