diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-28 17:16:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-28 17:16:41 +0900 |
| commit | 662d2d807700505da79d3089501f13ec0792c2ff (patch) | |
| tree | 4f78e107efbd1d3ac9350767ad954b13cef26aa9 /backend | |
| parent | aadc8cf037855b99cb82798c7b0ebaafc5bb025b (diff) | |
| download | iosdc-japan-2024-albatross-662d2d807700505da79d3089501f13ec0792c2ff.tar.gz iosdc-japan-2024-albatross-662d2d807700505da79d3089501f13ec0792c2ff.tar.zst iosdc-japan-2024-albatross-662d2d807700505da79d3089501f13ec0792c2ff.zip | |
feat(backend): log detailed error message in 5xx error
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/api/handlers.go | 7 |
1 files changed, 3 insertions, 4 deletions
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 { |
