From afc6343c21ff37912c6a37e1252492bb7680b761 Mon Sep 17 00:00:00 2001 From: "Prad Nukala (aider)" Date: Sun, 29 Dec 2024 13:19:21 -0500 Subject: [PATCH] fix: Handle only 500 errors in ErrorHandler --- gateway/handlers/errors.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gateway/handlers/errors.go b/gateway/handlers/errors.go index 29dd434df..a90d81252 100644 --- a/gateway/handlers/errors.go +++ b/gateway/handlers/errors.go @@ -5,11 +5,12 @@ import ( "github.com/onsonr/sonr/gateway/context" ) -// AI! Fix this error handler to only return on 500 errors func ErrorHandler(err error, c echo.Context) { if he, ok := err.(*echo.HTTPError); ok { - // Log the error if needed - c.Logger().Errorf("Error: %v", he.Message) - context.RenderError(c, he) + if he.Code == 500 { + // Log the error if needed + c.Logger().Errorf("Error: %v", he.Message) + context.RenderError(c, he) + } } }