fn handle_500_json(
        &self,
    ) -> impl Fn(warp::Rejection) -> Result<warp::http::Response<Vec<u8>>, Rejection> + Clone {
        #[derive(Serialize)]
        struct Json500Error {
            error: String,
        }
        |err: warp::Rejection| {
            if let Some(ref err) = err.find_cause::<SmeagolError>() {
                error!("Internal error: {}", err);
                Ok(ResponseBuilder::new()
                    .status(500)
                    .body_json(&Json500Error {
                        error: "An internal error occurred.".to_string(),
                    })?)
            } else {
                Err(err)
            }
        }
    }
/// Returns an error recovery handler for use with `Filter.recover` in JSON endpoints.
///
/// If the given route rejects with a `SmeagolError` the rejection is caught and replaced with
/// a simple error 500 value:
///
/// ```json
/// { "error": "An internal error occurred." }
/// ```
///
/// For HTML pages `self.handle_500_html` can be used.
Returns an error recovery handler for use with `Filter.recover` in JSON endpoints.
If the given route rejects with a `SmeagolError` the rejection is caught and replaced with
a simple error 500 value.



For HTML pages `self.handle_500_html` can be used.
Returns an error recovery handler for use with ` Filter . recover ` in JSON endpoints . If the given route rejects with a ` SmeagolError ` the rejection is caught and replaced with a simple error 500 value . For HTML pages ` self . handle_500_html ` can be used .
fn handle_500_json(
        &self,
    ) -> impl Fn(warp::Rejection) -> Result<warp::http::Response<Vec<u8>>, Rejection> + Clone {
        #[derive(Serialize)]
        struct Json500Error {
            error: String,
        }
        |err: warp::Rejection| {
            if let Some(ref err) = err.find_cause::<SmeagolError>() {
                error!("Internal error: {}", err);
                Ok(ResponseBuilder::new()
                    .status(500)
                    .body_json(&Json500Error {
                        error: "An internal error occurred.".to_string(),
                    })?)
            } else {
                Err(err)
            }
        }
    }
fn handle_500_json ( & self , ) -> impl Fn ( warp :: Rejection ) -> Result < warp :: http :: Response < Vec < u8 > > , Rejection > + Clone { # [ derive ( Serialize ) ] struct Json500Error { error : String , } | err : warp :: Rejection | { if let Some ( ref err ) = err . find_cause :: < SmeagolError > ( ) { error ! ( " " err ) ; Ok ( ResponseBuilder :: new ( ) . status ( 500 ) . body_json ( & Json500Error { error : " " . to_string ( ) , } ) ? ) } else { Err ( err ) } } }
Returns an error recovery handler for use with `Filter.recover` in JSON endpoints.
Returns an error recovery handler for use with ` Filter . recover ` in JSON endpoints .
&self
&self