mirror of
https://github.com/actix/actix-website
synced 2024-11-28 02:22:57 +01:00
22 lines
460 B
Rust
22 lines
460 B
Rust
|
mod helpers;
|
||
|
mod override_error;
|
||
|
mod recommend_one;
|
||
|
// <response-error>
|
||
|
use actix_web::{error, HttpRequest};
|
||
|
use failure::Fail;
|
||
|
|
||
|
#[derive(Fail, Debug)]
|
||
|
#[fail(display = "my error")]
|
||
|
struct MyError {
|
||
|
name: &'static str,
|
||
|
}
|
||
|
|
||
|
// Use default implementation for `error_response()` method
|
||
|
impl error::ResponseError for MyError {}
|
||
|
|
||
|
fn index(req: HttpRequest) -> Result<&'static str, MyError> {
|
||
|
Err(MyError { name: "test" })
|
||
|
}
|
||
|
// </response-error>
|
||
|
fn main() {}
|