Error Handling
All state endpoints can return a range of HTTP status codes indicating the result of the operation or specific issues encountered. These errors may stem from validation, business rules, session state, or system-level problems. Clients should interpret these codes consistently across endpoints and provide appropriate feedback to users.
| Status Code | Description |
|---|
401 | Unauthorized – session may have expired, or credentials are missing/invalid. |
403 | Forbidden – action is not permitted for the current user or session. |
404 | Resource not found – e.g., basketId missing from session context. |
410 | The requested resource is no longer available (e.g., confirmed order). |
417 | Customer account was deleted or blocked. |
422 | Validation error – input data does not meet the required schema. |
423 | Resource is locked – e.g., basket or order is currently in use or updating. |
424 | Dependency failure – another service or operation failed. |
451 | Access restricted due to legal reasons. May include an error body for details. |
| Status Code | Description |
|---|
500 | Internal server error – unexpected condition or system fault. |
- Treat
4xx errors as user-facing issues and display actionable or explanatory messages. - Treat
5xx errors as system failures, suggest retry or escalate to support. - Handle
401 and 403 by redirecting to login or refreshing the session. - For
422, parse the validation details (if present) and highlight specific input issues. 423, 424, and 412 may indicate transient issues – consider retry logic with delay.