An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(MM-70): error types and shared API envelope #13

Adds ApiError and ErrorCode to the common crate to establish the shared provisioning API error envelope used by all future endpoints.

Changes#

  • crates/common/src/error.rs — new module:
    • ErrorCode enum (#[non_exhaustive], Wave 0–2 set) serialized as SCREAMING_SNAKE_CASE strings
    • ApiError { code, message, details } serialized to { "error": { "code": "...", "message": "...", "details": {} } }
    • impl IntoResponse for ApiError — maps each code to its HTTP status
    • details is Option<serde_json::Value>, omitted from JSON when absent
  • crates/common/Cargo.toml — added axum, serde_json deps
  • crates/common/src/lib.rs — re-exports ApiError, ErrorCode

Tests#

4 unit tests covering:

  • Correct envelope shape (nested error key)
  • details included when present, absent when None
  • All 8 error code → HTTP status mappings

Notes#

ErrorCode is #[non_exhaustive] so external crates must handle _ in match arms. New variants for later waves can be added without breaking existing callers.

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:web:malpercio.dev/sh.tangled.repo.pull/3mgmxklhawd22
Diff #0

No differences found between the selected revisions.

History

1 round 0 comments
sign up or login to add to the discussion
malpercio.dev submitted #0
patch application failed: error: No valid patches in input (allow with "--allow-empty")
expand 0 comments