Question: how to implement custom error handler for 404 not found #2564
Answered
by
robjtede
CSRaghunandan
asked this question in
Q&A
Replies: 1 comment
-
let (req, res) = res.into_parts();
let res = res.set_body(r#"{"json", "in the body"}"#.to_owned());
let res = ServiceResponse::new(req, res)
.map_into_boxed_body()
.map_into_right_body();
Ok(ErrorHandlerResponse::Response(res)) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CSRaghunandan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to send JSON responses for all types of errors.
I tried to do something like for 404 not found errors, but not sure how to proceed further:
I'm using the latest actix web beta version 18
Beta Was this translation helpful? Give feedback.
All reactions