|
1 | 1 | from fastapi import HTTPException, status |
2 | | -from utils.core.enums import ValidPermissions |
3 | 2 |
|
4 | 3 | class RateLimitError(HTTPException): |
5 | 4 | """Raised when a client exceeds the allowed request rate.""" |
@@ -106,7 +105,7 @@ def __init__(self): |
106 | 105 | class InvalidPermissionError(HTTPException): |
107 | 106 | """Raised when a user attempts to assign an invalid permission to a role""" |
108 | 107 |
|
109 | | - def __init__(self, permission: ValidPermissions): |
| 108 | + def __init__(self, permission: str): |
110 | 109 | super().__init__( |
111 | 110 | status_code=400, |
112 | 111 | detail=f"Invalid permission: {permission}" |
@@ -224,6 +223,33 @@ def __init__(self): |
224 | 223 | ) |
225 | 224 |
|
226 | 225 |
|
| 226 | +class MaxEmailsReachedError(HTTPException): |
| 227 | + """Raised when an account already has the maximum number of email addresses.""" |
| 228 | + def __init__(self): |
| 229 | + super().__init__( |
| 230 | + status_code=400, |
| 231 | + detail="Maximum number of email addresses reached" |
| 232 | + ) |
| 233 | + |
| 234 | + |
| 235 | +class EmailNotVerifiedError(HTTPException): |
| 236 | + """Raised when attempting to promote an unverified email address.""" |
| 237 | + def __init__(self): |
| 238 | + super().__init__( |
| 239 | + status_code=400, |
| 240 | + detail="Email address is not verified" |
| 241 | + ) |
| 242 | + |
| 243 | + |
| 244 | +class CannotRemovePrimaryEmailError(HTTPException): |
| 245 | + """Raised when attempting to remove the primary email address.""" |
| 246 | + def __init__(self): |
| 247 | + super().__init__( |
| 248 | + status_code=400, |
| 249 | + detail="Cannot remove primary email address" |
| 250 | + ) |
| 251 | + |
| 252 | + |
227 | 253 | class InvitationProcessingError(HTTPException): |
228 | 254 | """Raised when an error occurs during the processing of a valid invitation.""" |
229 | 255 | def __init__(self, detail: str = "Failed to process invitation. Please try again later."): |
|
0 commit comments