What problem does it solve?
Building robust Salvo-based APIs requires consistent error reporting, safe handling of business and system failures, and resilient responses to panics. This skill provides a structured approach to map errors into HTTP status codes, provide clear JSON error payloads, and centralize error-related concerns.
Core Features & Use Cases
- Status-based mapping: Convert business errors, validation issues, and server faults into appropriate 4xx/5xx responses with meaningful messages.
- Custom error types & JSON APIs: Define Writer/thiserror patterns to produce uniform error payloads and reduce leakage of internal details.
- Panic safety & logging: Use CatchPanic and logging to catch panics, log context, and return safe responses.
- Use Case: Build reliable APIs that fail gracefully under invalid input, missing resources, or database outages.
Quick Start
Integrate StatusError with your Salvo routes to return consistent JSON errors for 4xx/5xx responses.