[FEAT] New error handling and pagination #14
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
fix
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
tom/vps-back!14
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/error-handling-and-pagination"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR introduces three major improvements to the API:
Changes
Error Handling
anyhow(with backtrace) andthiserror 2.0src/error.rs: API error types with proper HTTP status mappingValidationFailed→ 400 Bad RequestNotFound→ 404 Not FoundInternal→ 500 (wraps anyhow errors, logs details but hides from users)Database→ 500 (wraps SeaORM errors)src/db.rs: Usesanyhow::Resultwith rich context chainsunwrap()/expect()in production code.context()at each error point for debugging narrativesAPI Response Format
Pagination
Testing
Breaking Changes
⚠️ Response format has changed:
Example Usage
Default pagination
GET /secure/stickers
Custom pagination
GET /secure/stickers?page=2&limit=50
Navigation via metadata links