Add 422 status for invalid email domain
Publish Package / build-and-publish (push) Successful in 12s
Publish Package / build-and-publish (push) Successful in 12s
This commit is contained in:
1 parent
fd9f9ae5bc
commit
d67bd3781b
1 file changed
+3
@@ -16,6 +16,7 @@ export type UserApiErrorCode =
|
||||
| 'VALIDATION'
|
||||
| 'AUTH'
|
||||
| 'NOT_FOUND'
|
||||
| 'UNPROCESSABLE_ENTITY'
|
||||
| 'RATE_LIMIT'
|
||||
| 'SERVER';
|
||||
|
||||
@@ -23,6 +24,7 @@ const ERROR_DESCRIPTIONS: Record<UserApiErrorCode, string> = {
|
||||
VALIDATION: 'The request was invalid or contained malformed data',
|
||||
AUTH: 'Authentication failed — missing or invalid API key',
|
||||
NOT_FOUND: 'The requested user account was not found',
|
||||
UNPROCESSABLE_ENTITY: 'The registration email is not from a permitted domain',
|
||||
RATE_LIMIT: 'Rate limit exceeded — too many requests, try again shortly',
|
||||
SERVER: 'The server encountered an internal error',
|
||||
};
|
||||
@@ -69,6 +71,7 @@ function statusToCode(status: number): UserApiErrorCode {
|
||||
case 401:
|
||||
case 403: return 'AUTH';
|
||||
case 404: return 'NOT_FOUND';
|
||||
case 422: return 'UNPROCESSABLE_ENTITY';
|
||||
case 429: return 'RATE_LIMIT';
|
||||
default: return 'SERVER';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user