axum/examples/customize-extractor-error
2025-12-28 09:25:50 +01:00
..
src Fix return types of serve futures (#3601) 2025-12-28 09:25:50 +01:00
Cargo.toml examples: Update to thiserror 2 (#3522) 2025-10-08 23:19:41 +09:00
README.md

This example explores 3 different ways you can create custom rejections for already existing extractors

  • with_rejection: Uses axum_extra::extract::WithRejection to transform one rejection into another
  • derive_from_request: Uses the axum::extract::FromRequest derive macro to wrap another extractor and customize the rejection
  • custom_extractor: Manual implementation of FromRequest that wraps another extractor

Run with

cargo run -p example-customize-extractor-error