mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-03 00:00:07 +02:00
Add ErrorKind::DeserializeError to specialize ErrorKind::Message (extract::path::ErrorKind) (#2720)
This commit introduces another `extract::path::ErrorKind` variant that captures the serde error nominally captured through the `serde::de::Error` trait impl on `PathDeserializeError`. We augment the deserialization error with the captured (key, value), allowing `extract::Path`, and wrapping extractors, to gain programmatic access to the key name, and attempted deserialized value. The `PathDeserializationError::custom` is used two places in addition to capture the deserialization error. These usages should still be unaffected. Co-authored-by: David Mládek <[email protected]>
This commit is contained in:
co-authored by
David Mládek
parent
6e0559e687
commit
59a2960e42
@@ -94,7 +94,7 @@ mod tests {
|
||||
let res = client.get("/NaN").await;
|
||||
assert_eq!(
|
||||
res.text().await,
|
||||
"Invalid URL: Cannot parse `\"NaN\"` to a `u32`"
|
||||
"Invalid URL: Cannot parse `NaN` to a `u32`"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user