https://github.com/wyatt-herkamp/this_actix_errors
Generate an Actix Error Handler with Macros
https://github.com/wyatt-herkamp/this_actix_errors
actix rust
Last synced: about 1 month ago
JSON representation
Generate an Actix Error Handler with Macros
- Host: GitHub
- URL: https://github.com/wyatt-herkamp/this_actix_errors
- Owner: wyatt-herkamp
- License: apache-2.0
- Created: 2022-08-02T21:12:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T12:48:13.000Z (6 months ago)
- Last Synced: 2025-01-27T13:50:26.189Z (3 months ago)
- Topics: actix, rust
- Language: Rust
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# this_actix_error
Example Usage
I recommend pairing this macro with [ThisError](https://github.com/dtolnay/thiserror)
```rust
#[derive(Error, Debug, ActixError)]
pub enum WebError {
/// Has the Error Message Defined through ThisError, A Status code and a message used by ActixError
#[status_code(500)]
#[message("An Internal Error Occured")]
#[error("Failed to read {0}")]
Io(#[from] std::io::Error),
/// Uses the Error Message Defined through ThisError, A Status code used by ActixError
#[status_code(500)]
#[error("Test Error")]
Test,
/// Same as the above but uses a Ident for the Status_code
#[status_code(BAD_REQUEST)]
#[error("Bad Request")]
Two,
}
```