Files
romm/backend/exceptions/database_exceptions.py
Georges-Antoine Assi 012ae2fa1e refactor(user): confirm an email inside the single user update
pr-ready step 3 (simplify). The confirmation now rides the one
apply_user_update transaction, guarded by expected_email, so a later 400
or 403 rolls it back and the edit audit sees it without a post-write
patch. update_user resets trust whenever it writes an email the caller
doesn't vouch for, replacing trust_email. Tests share the dialog's apply,
save and emailField helpers, and drop two redundant local imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:30:48 -05:00

28 lines
808 B
Python

class RomFileOwnerChangedError(Exception):
def __init__(self, rom_file_id: int) -> None:
self.message = (
f"Rom file {rom_file_id} moved to another rom while it was being locked"
)
super().__init__(self.message)
def __repr__(self) -> str:
return self.message
class EmailChangedError(Exception):
def __init__(self, user_id: int) -> None:
self.message = f"User {user_id} no longer has the expected email"
super().__init__(self.message)
def __repr__(self) -> str:
return self.message
class LastAdminError(Exception):
def __init__(self, user_id: int) -> None:
self.message = f"User {user_id} is the last admin"
super().__init__(self.message)
def __repr__(self) -> str:
return self.message