1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use rocket::Rocket; use rocket::fairing::{Fairing, Info, Kind}; use error; pub struct JsonApiFairing; impl Fairing for JsonApiFairing { fn info(&self) -> Info { Info { kind: Kind::Attach, name: "JsonApiFairing", } } fn on_attach(&self, rocket: Rocket) -> Result<Rocket, Rocket> { let rocket = rocket.catch(error::catchers()); Ok(rocket) } }