Cognitect Anomalies - standardized error categories.
Based on https://github.com/cognitect-labs/anomalies
Anomalies are maps with ::category key indicating the error type. These map to HTTP status codes:
| Category | HTTP | Description |
|---|---|---|
| ::unavailable | 503 | Service temporarily unavailable, retry later |
| ::interrupted | 500 | Operation was interrupted |
| ::incorrect | 400 | Bad request, invalid input |
| ::forbidden | 403 | Not authorized to perform this action |
| ::unauthorized | 401 | Authentication required |
| ::not-found | 404 | Resource not found |
| ::conflict | 409 | Conflict with current state (e.g., duplicate) |
| ::fault | 500 | Internal server error |
| ::busy | 503 | Server is busy, retry later |
| ::unsupported | 501 | Operation not supported |
Usage: (throw! ::forbidden "You are not authorized to access this resource") (throw! ::not-found "Therapy plan not found" {:plan-id plan-id}) (throw! ::incorrect "Invalid email format" {:field :email})
Cognitect Anomalies - standardized error categories.
Based on https://github.com/cognitect-labs/anomalies
Anomalies are maps with ::category key indicating the error type.
These map to HTTP status codes:
| Category | HTTP | Description |
|---------------|------|------------------------------------------------|
| ::unavailable | 503 | Service temporarily unavailable, retry later |
| ::interrupted | 500 | Operation was interrupted |
| ::incorrect | 400 | Bad request, invalid input |
| ::forbidden | 403 | Not authorized to perform this action |
| ::unauthorized| 401 | Authentication required |
| ::not-found | 404 | Resource not found |
| ::conflict | 409 | Conflict with current state (e.g., duplicate) |
| ::fault | 500 | Internal server error |
| ::busy | 503 | Server is busy, retry later |
| ::unsupported | 501 | Operation not supported |
Usage:
(throw! ::forbidden "You are not authorized to access this resource")
(throw! ::not-found "Therapy plan not found" {:plan-id plan-id})
(throw! ::incorrect "Invalid email format" {:field :email})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |