accounts: codes d'erreur comptes/quotas (EMAIL_TAKEN, INVALID_TOKEN, INVALID_CREDENTIALS…) + fakeredis[lua] en dev
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 changed files +16 −2
modified
hfmarketdata/api/core/errors.py
+11 −0
@@ -40,6 +40,17 @@ CODES: dict[str, str] = { | ||
| 40 | 40 | "CONFLICT": "The resource already exists or is in a conflicting state.", |
| 41 | 41 | "INTERNAL_ERROR": "Unexpected server error.", |
| 42 | 42 | "SERVICE_UNAVAILABLE": "A dependency (Redis, data lake) is unavailable.", |
| 43 | + # accounts / auth (chantier 2) | |
| 44 | + "EMAIL_TAKEN": "An account with this e-mail already exists.", | |
| 45 | + "INVALID_TOKEN": "The verification, invitation or reset token is invalid, expired or already used.", | |
| 46 | + "INVALID_CREDENTIALS": "Unknown e-mail or wrong password.", | |
| 47 | + "EMAIL_NOT_VERIFIED": "Verify your e-mail address before signing in.", | |
| 48 | + "ACCOUNT_DISABLED": "This account has been disabled.", | |
| 49 | + "WEAK_PASSWORD": "Password must be at least 10 characters.", | |
| 50 | + "USER_NOT_FOUND": "No account with this id or e-mail.", | |
| 51 | + "KEY_NOT_FOUND": "No API key with this id on your account.", | |
| 52 | + "KEY_LIMIT_REACHED": "Maximum number of active API keys reached; revoke one first.", | |
| 53 | + "UNSUPPORTED_MEDIA_TYPE": "State-changing requests must send `Content-Type: application/json`.", | |
| 43 | 54 | } |
| 44 | 55 | |
| 45 | 56 | |
modified
hfmarketdata/api/openapi.py
+4 −1
@@ -56,7 +56,10 @@ STATUS_FOR = {"INVALID_PARAMETER": 400, "VALIDATION_ERROR": 422, "NOT_FOUND": 40 | ||
| 56 | 56 | "ASSET_NOT_FOUND": 404, "INVALID_CONTRACT_SYMBOL": 400, "CONTRACT_NOT_FOUND": 404, "ROOT_NOT_FOUND": 404, |
| 57 | 57 | "OPTIONS_UNAVAILABLE": 503, "INVALID_API_KEY": 401, "AUTH_REQUIRED": 401, "FORBIDDEN": 403, |
| 58 | 58 | "RATE_LIMIT_EXCEEDED": 429, "ROW_LIMIT_EXCEEDED": 400, "CONFLICT": 409, "INTERNAL_ERROR": 500, |
| 59 | − "SERVICE_UNAVAILABLE": 503} | |
| 59 | + "SERVICE_UNAVAILABLE": 503, | |
| 60 | + "EMAIL_TAKEN": 409, "INVALID_TOKEN": 400, "INVALID_CREDENTIALS": 401, "EMAIL_NOT_VERIFIED": 403, | |
| 61 | + "ACCOUNT_DISABLED": 403, "WEAK_PASSWORD": 400, "USER_NOT_FOUND": 404, "KEY_NOT_FOUND": 404, | |
| 62 | + "KEY_LIMIT_REACHED": 409, "UNSUPPORTED_MEDIA_TYPE": 415} | |
| 60 | 63 | |
| 61 | 64 | |
| 62 | 65 | def build(app: FastAPI) -> dict: |
modified
requirements-dev.txt
+1 −1
@@ -1,7 +1,7 @@ | ||
| 1 | 1 | -r hfmarketdata/requirements.txt |
| 2 | 2 | pytest>=8 |
| 3 | 3 | pytest-asyncio>=0.23 |
| 4 | −fakeredis>=2.23 | |
| 4 | +fakeredis[lua]>=2.23 | |
| 5 | 5 | freezegun>=1.5 |
| 6 | 6 | respx>=0.21 |
| 7 | 7 | ruff>=0.6 |
| 8 | 8 | |