You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.9 KiB
1.9 KiB
+++ title = 'Implement error handling — consistent {"error": "..."} envelope for 400/403/404/422/500' priority = 5 status = "done" ticket_type = "task" dependencies = ["1f5bb5", "6e829e"] +++
The `quotesdb` API is built with Axum + Tokio, targeting Cloudflare Workers via `workers-rs`. It serves JSON at `/api/*` endpoints and persists data to Cloudflare D1 (production) or a local SQLite file via Turso (development). Source lives in `src/bin/api/`.Shared types and utilities are in src/lib.rs — code placed there must compile for both the host target and wasm32-unknown-unknown.
All error responses must use a consistent JSON envelope: {"error": "message"}. The API returns errors with appropriate HTTP status codes: 400 Bad Request, 403 Forbidden (wrong auth), 404 Not Found, 422 Unprocessable Entity (validation), 500 Internal Server Error.
cargo fmt
cargo check
cargo clippy
cargo test
`feat(quotesdb): implement consistent error envelope type for all API responses`