1
0
mirror of https://github.com/actix/actix-website synced 2024-11-28 02:22:57 +01:00
actix-website/examples/errors/src/main.rs

22 lines
460 B
Rust
Raw Normal View History

2019-06-17 19:46:21 +02:00
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() {}