-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to disable catchers? #1040
Comments
As far as I can tell the change here was not in Rocket, but in the route ( If you removed |
Ah, great, thank you! |
@jebrosen, sorry to bug you again, I'm still struggling with this. In addition to the impl FromDataSimple for Email {
type Error = AppError;
fn from_data(request: &Request, data: Data) -> Outcome<Self, Self::Error> {
let mut email_address = String::new();
if let Err(error) = data.open().take(1024).read_to_string(&mut email_address) {
return Outcome::Failure((
Status::InternalServerError,
AppErrorKind::Internal(error.to_string()).into(),
));
}
Json::<Email>::from_data(
request,
Transform::Borrowed(Outcome::Success(&email_address)),
)
.map_failure(|(_status, error)| {
match error {
JsonError::Io(ref inner) => (
Status::InternalServerError,
AppErrorKind::Internal(inner.to_string()).into(),
),
JsonError::Parse(_, ref inner) => (
Status::BadRequest,
AppErrorKind::InvalidPayload(inner.to_string()).into(),
),
}
})
.map(|json| json.into_inner())
}
} I can see the appropriate Any ideas what I'm doing wrong? |
Ignore me sorry, just realised I needed to wrap the argument in an AppResult in my route handler too. All good now! |
I feel like there's probably a straightforward answer to this staring me in the face, but I've not been able to find it, sorry.
Anyway, I'm updating an old codebase from 0.3.17 to 0.4.1. It contains an error type that impls
Responder
like so (it also implsSerialize
):There are some tests for my API that look like this:
Before updating to 0.4 these succeed, but now they fail and the output indicates the default
422
catcher is taking control of the response:What should I do to stop the catcher kicking in?
The text was updated successfully, but these errors were encountered: