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

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