// Receives `ApiError`s and `JsonDeserializeError` and return it in the RFC7807 format.
Receives `ApiError`s and `JsonDeserializeError` and return it in the RFC7807 format.
Receives ` ApiError ` s and ` JsonDeserializeError ` and return it in the RFC7807 format .
pub async fn default_rejection_handler(err: warp::Rejection) -> Result<impl Reply, Rejection> {
    if let Some(api_error) = err.find::<ApiError>() {
        Ok(api_error.clone().into_response())
    } else if let Some(json_error) = err.find::<JsonDeserializeError>() {
        Ok(json_error.clone().into_response())
    } else if err.find::<warp::reject::MethodNotAllowed>().is_some() {
        Ok(ApiError::from_api_error_type(&DEFAULT_METHOD_NOT_ALLOWED_TYPE).into_response())
    } else {
        Err(err)
    }
}
pub async fn default_rejection_handler ( err : warp :: Rejection ) -> Result < impl Reply , Rejection > { if let Some ( api_error ) = err . find :: < ApiError > ( ) { Ok ( api_error . clone ( ) . into_response ( ) ) } else if let Some ( json_error ) = err . find :: < JsonDeserializeError > ( ) { Ok ( json_error . clone ( ) . into_response ( ) ) } else if err . find :: < warp :: reject :: MethodNotAllowed > ( ) . is_some ( ) { Ok ( ApiError :: from_api_error_type ( & DEFAULT_METHOD_NOT_ALLOWED_TYPE ) . into_response ( ) ) } else { Err ( err ) } }
Receives `ApiError`s and `JsonDeserializeError` and return it in the RFC7807 format.
Receives ` ApiError ` s and ` JsonDeserializeError ` and return it in the RFC7807 format .
err
warp::Rejection