Error handler for a 404 Page not found error.
(res: ServiceResponse<B>)
| 95 | |
| 96 | // Error handler for a 404 Page not found error. |
| 97 | fn not_found<B>(res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<BoxBody>> { |
| 98 | let lang = LangChoice::from_req(res.request()).lang_id(); |
| 99 | let error = LOCALES.lookup(&lang, "error-not-found"); |
| 100 | |
| 101 | let response = get_error_response(&res, &error); |
| 102 | |
| 103 | Ok(ErrorHandlerResponse::Response(ServiceResponse::new( |
| 104 | res.into_parts().0, |
| 105 | response.map_into_left_body(), |
| 106 | ))) |
| 107 | } |
| 108 | |
| 109 | // Generic error handler. |
| 110 | fn get_error_response<B>(res: &ServiceResponse<B>, error: &str) -> HttpResponse<BoxBody> { |
nothing calls this directly
no test coverage detected