Browse Source

feat: improved error message for signup

Timothy J. Baek 1 year ago
parent
commit
7c553f1287
2 changed files with 2 additions and 3 deletions
  1. 1 1
      backend/apps/web/routers/auths.py
  2. 1 2
      backend/constants.py

+ 1 - 1
backend/apps/web/routers/auths.py

@@ -104,7 +104,7 @@ async def signup(form_data: SignupForm):
                     "profile_image_url": user.profile_image_url,
                     "profile_image_url": user.profile_image_url,
                 }
                 }
             else:
             else:
-                raise HTTPException(500, detail=ERROR_MESSAGES.DEFAULT())
+                raise HTTPException(500, detail=ERROR_MESSAGES.CREATE_USER_ERROR)
         except Exception as err:
         except Exception as err:
             raise HTTPException(500, detail=ERROR_MESSAGES.DEFAULT(err))
             raise HTTPException(500, detail=ERROR_MESSAGES.DEFAULT(err))
     else:
     else:

+ 1 - 2
backend/constants.py

@@ -11,12 +11,11 @@ class ERROR_MESSAGES(str, Enum):
 
 
     DEFAULT = lambda err="": f"Something went wrong :/\n{err if err else ''}"
     DEFAULT = lambda err="": f"Something went wrong :/\n{err if err else ''}"
     ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now."
     ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now."
-
+    CREATE_USER_ERROR = "Oops! Something went wrong while creating your account. Please try again later. If the issue persists, contact support for assistance."
     EMAIL_TAKEN = "Uh-oh! This email is already registered. Sign in with your existing account or choose another email to start anew."
     EMAIL_TAKEN = "Uh-oh! This email is already registered. Sign in with your existing account or choose another email to start anew."
     USERNAME_TAKEN = (
     USERNAME_TAKEN = (
         "Uh-oh! This username is already registered. Please choose another username."
         "Uh-oh! This username is already registered. Please choose another username."
     )
     )
-
     INVALID_TOKEN = (
     INVALID_TOKEN = (
         "Your session has expired or the token is invalid. Please sign in again."
         "Your session has expired or the token is invalid. Please sign in again."
     )
     )