From 662d2d807700505da79d3089501f13ec0792c2ff Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 28 Jul 2024 17:16:41 +0900 Subject: feat(backend): log detailed error message in 5xx error --- backend/api/handlers.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'backend/api/handlers.go') diff --git a/backend/api/handlers.go b/backend/api/handlers.go index 9856ce9..43ff8c6 100644 --- a/backend/api/handlers.go +++ b/backend/api/handlers.go @@ -42,8 +42,7 @@ func (h *ApiHandler) PostLogin(ctx context.Context, request PostLoginRequestObje jwt, err := auth.NewJWT(&user) if err != nil { - // TODO - return nil, echo.NewHTTPError(http.StatusInternalServerError) + return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } return PostLogin200JSONResponse{ @@ -64,7 +63,7 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject if playerId == nil { gameRows, err := h.q.ListGames(ctx) if err != nil { - return nil, echo.NewHTTPError(http.StatusInternalServerError) + return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } games := make([]Game, len(gameRows)) for i, row := range gameRows { @@ -99,7 +98,7 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject } else { gameRows, err := h.q.ListGamesForPlayer(ctx, int32(*playerId)) if err != nil { - return nil, echo.NewHTTPError(http.StatusInternalServerError) + return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } games := make([]Game, len(gameRows)) for i, row := range gameRows { -- cgit v1.2.3-70-g09d2