mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 23:38:20 +01:00
789f51ba1a
* examples: Created new `error-handling` example
* examples(error-handling): Add error codes and responses
* examples(error-handling): `custom_extractor`
* examples(error-handling): `derive_from_request`
* examples(error-handling): Using POST instead of GET
* examples(error-handling): Using `thiserror` for `derive_from_request`
* examples(error-handling): Using `snake-case` for routes
* revert(error-handling): Use `From` impl instead of `thiserror`
refs:
|
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
This example explores 3 different ways you can create custom rejections for already existing extractors
with_rejection
: Usesaxum_extra::extract::WithRejection
to transform one rejection into anotherderive_from_request
: Usesaxum_macros::FromRequest
to wrap another extractor and customize the rejectioncustom_extractor
: Manual implementation ofFromRequest
that wraps another extractor
Run with
cd examples && cargo run -p example-customize-extractor-error