Skip to content

Commit

Permalink
feat(extract::Path): change format of value in ErrorKind to non-Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
vegardgs-ksat committed Aug 30, 2024
1 parent 3d0d6e6 commit f7c94df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion axum-extra/src/extract/optional_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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`"
);
}
}
12 changes: 6 additions & 6 deletions axum/src/extract/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,25 @@ impl fmt::Display for ErrorKind {
expected_type,
} => write!(
f,
"Cannot parse `{key}` with value `{value:?}` to a `{expected_type}`"
"Cannot parse `{key}` with value `{value}` to a `{expected_type}`"
),
ErrorKind::ParseError {
value,
expected_type,
} => write!(f, "Cannot parse `{value:?}` to a `{expected_type}`"),
} => write!(f, "Cannot parse `{value}` to a `{expected_type}`"),
ErrorKind::ParseErrorAtIndex {
index,
value,
expected_type,
} => write!(
f,
"Cannot parse value at index {index} with value `{value:?}` to a `{expected_type}`"
"Cannot parse value at index {index} with value `{value}` to a `{expected_type}`"
),
ErrorKind::DeserializeError {
key,
value,
message,
} => write!(f, "Cannot parse `{key}` with value `{value:?}`: {message}"),
} => write!(f, "Cannot parse `{key}` with value `{value}`: {message}"),
}
}
}
Expand Down Expand Up @@ -919,7 +919,7 @@ mod tests {
let body = res.text().await;
assert_eq!(
body,
r#"Invalid URL: Cannot parse `res` with value `"123123-123-123123"`: UUID parsing failed: invalid group count: expected 5, found 3"#
r#"Invalid URL: Cannot parse `res` with value `123123-123-123123`: UUID parsing failed: invalid group count: expected 5, found 3"#
);
}

Expand All @@ -940,7 +940,7 @@ mod tests {
let body = res.text().await;
assert_eq!(
body,
r#"Invalid URL: Cannot parse `res` with value `"456456-123-456456"`: UUID parsing failed: invalid group count: expected 5, found 3"#
r#"Invalid URL: Cannot parse `res` with value `456456-123-456456`: UUID parsing failed: invalid group count: expected 5, found 3"#
);
}
}

0 comments on commit f7c94df

Please sign in to comment.