add error message user not found

This commit is contained in:
nochill 2023-09-27 22:34:52 +07:00
parent 675abcdb18
commit 1f055e92d4

View File

@ -135,7 +135,7 @@ func (server *Server) login(ctx *gin.Context) {
user, err := server.Store.GetUser(ctx, req.Username)
if err != nil {
if err == sql.ErrNoRows {
ctx.JSON(http.StatusNotFound, ErrorResponse(err, ""))
ctx.JSON(http.StatusNotFound, ErrorResponse(err, "User not found"))
return
}
ctx.JSON(http.StatusInternalServerError, ErrorResponse(err, "Something went wrong whlie try to get user"))