domainstack-http
Framework-agnostic HTTP error handling for the domainstack full-stack validation ecosystem.
Overview
This crate provides shared HTTP error types and utilities used by framework-specific adapters like domainstack-axum and domainstack-actix.
Most users should use framework adapters directly instead of this crate:
- domainstack-axum - For Axum web framework
- domainstack-actix - For Actix-web framework
Usage
Only use this crate directly if you're:
- Building a new framework adapter for domainstack
- Need framework-agnostic error handling
Add this to your Cargo.toml:
[]
= "1.0"
= "1.0"
Types
ErrorResponse - Framework-agnostic HTTP error response:
use ErrorResponse;
use ValidationError;
let validation_error = single;
let response = from;
// Contains error-envelope formatted response with 400 status
Framework Adapters
This crate is used internally by:
- domainstack-axum - Implements
IntoResponsefor Axum - domainstack-actix - Implements
ResponseErrorfor Actix-web
Both adapters use ErrorResponse as their common error type and add framework-specific trait implementations.
Building Custom Adapters
If you're integrating domainstack with another web framework:
- Add
domainstack-httpanddomainstack-envelopedependencies - Use
ErrorResponseas your error type - Implement your framework's error trait
- Convert
ErrorResponse::inner(which iserror_envelope::Error) to your framework's response type
See domainstack-axum or domainstack-actix source code for reference implementations.
Documentation
For complete documentation and examples, see:
- domainstack documentation
- domainstack-axum documentation
- domainstack-actix documentation
- GitHub repository
License
Apache 2.0