Add 422 status for invalid email domain
Publish Package / build-and-publish (push) Successful in 12s

This commit is contained in:
fred.boniface committed 2026-10-28 20:08:44 +00:00
1 parent fd9f9ae5bc
commit d67bd3781b
1 file changed
+3
+3
View File
@@ -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';
}