Skip to content

fix: specific error messages for user registration#90

Open
Luna161 wants to merge 1 commit into
Jespermagician:mainfrom
Luna161:fix/34-better-error-handling
Open

fix: specific error messages for user registration#90
Luna161 wants to merge 1 commit into
Jespermagician:mainfrom
Luna161:fix/34-better-error-handling

Conversation

@Luna161
Copy link
Copy Markdown

@Luna161 Luna161 commented May 9, 2026

Closes #34

Problem

Users.RegisterUser() only returned None on failure with no indication of what went wrong. The register endpoint returned an empty {} response.

Fix

  • RegisterUser now returns (user, error_message) tuple — (user, None) on success, (None, "description") on failure
  • Specific error messages for: missing fields, password too short, missing special chars, duplicate email, database errors, user creation failures
  • Register view returns descriptive JSON error messages
  • Handles JSON decode errors (400 instead of 500)
  • Graceful handling when verification email fails (user is still created)
  • Removed all debug print() statements from RegisterUser

RegisterUser now returns (user, error_message) tuple instead of just
None on failure. Error messages cover: missing fields, password
requirements, duplicate email, database errors, and creation failures.

The register view now returns descriptive JSON error messages
instead of empty responses. Also handles JSON decode errors and
mail sending failures gracefully.

Closes Jespermagician#34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better Error handling

1 participant