1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

Added initial support for PathConfig, allows setting custom error handler. (#903)

This commit is contained in:
Lucas Berezy
2019-06-12 20:49:56 +10:00
committed by Nikolay Kim
parent 36e6f0cb4b
commit 13e618b128
3 changed files with 98 additions and 3 deletions

View File

@@ -92,6 +92,25 @@ impl ResponseError for JsonPayloadError {
}
}
/// A set of errors that can occur during parsing request paths
#[derive(Debug, Display, From)]
pub enum PathPayloadError {
/// Deserialize error
#[display(fmt = "Path deserialize error: {}", _0)]
Deserialize(de::Error),
}
/// Return `BadRequest` for `PathPayloadError`
impl ResponseError for PathPayloadError {
fn error_response(&self) -> HttpResponse {
match *self {
PathPayloadError::Deserialize(_) => {
HttpResponse::new(StatusCode::BAD_REQUEST)
}
}
}
}
/// A set of errors that can occur during parsing query strings
#[derive(Debug, Display, From)]
pub enum QueryPayloadError {