MCPcopy Create free account
hub / github.com/actix/examples / not_found

Function not_found

templating/fluent/src/main.rs:97–107  ·  view source on GitHub ↗

Error handler for a 404 Page not found error.

(res: ServiceResponse<B>)

Source from the content-addressed store, hash-verified

95
96// Error handler for a 404 Page not found error.
97fn 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.
110fn get_error_response<B>(res: &ServiceResponse<B>, error: &str) -> HttpResponse<BoxBody> {

Callers

nothing calls this directly

Calls 3

ResponseClass · 0.85
lang_idMethod · 0.80
get_error_responseFunction · 0.70

Tested by

no test coverage detected