Skip to content

Commit

Permalink
fix: logic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopertz committed Sep 9, 2024
1 parent a2fbcf5 commit 2d76013
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (app *application) registerUserHandler(c echo.Context) error {
inp.ChesscomUsername = c.FormValue("chesscom_username")
inp.PhoneNumber = c.FormValue("phone_number")


if err := app.validator.Struct(inp); err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()})
}
Expand All @@ -66,8 +65,11 @@ func (app *application) registerUserHandler(c echo.Context) error {
return c.JSON(http.StatusRequestEntityTooLarge, "File too large")
}

slog.Error("failed processing file upload", "error", err.Error())
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "internal server error"})
if is_file_uploaded {
slog.Error("failed processing file upload", "error", err.Error())
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "internal server error"})
}

}

if is_file_uploaded {
Expand Down

0 comments on commit 2d76013

Please sign in to comment.