From ab6af187aa6bf1de8f1778fdf762cef45077d65f Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Sun, 8 Dec 2024 16:02:17 +0800 Subject: [PATCH] Add c.Response().Committed check in example customHTTPErrorHandler (#359) --- website/docs/guide/error-handling.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/website/docs/guide/error-handling.md b/website/docs/guide/error-handling.md index 629dbbdd..120bdf79 100644 --- a/website/docs/guide/error-handling.md +++ b/website/docs/guide/error-handling.md @@ -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