Error message when trying to parse a random string as a UUID is not helpful #499
Labels
No labels
breaking
bug
dependencies
good first issue
help wanted
unstable
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-uuid-rs/uuid#499
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
When trying to deserialize something that should contain a UUID, but contains some other string that doesn't happen to be 32 or 36 characters long, one gets this error message from serde:
invalid length: expected one of [36, 32], found <something>This is very unhelpful.
Expected behavior
I would expect the error to state that UUID parsing failed. The fact that it failed at a length check would be nice to have as a detail, but is far less important.
Other
I think a good fix for this would be to change the serde code to wrap the UUID parsing error in
format!("UUID parsing failed: {}", e)or something like that. If you want, I'll open a PR.This sounds like a nice improvement to me! Would you be happy to submit a PR @jplatte?
Will do.