Skip to content
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

Error message when trying to parse a random string as a UUID is not helpful #499

Closed
jplatte opened this issue Nov 23, 2020 · 2 comments · Fixed by #505
Closed

Error message when trying to parse a random string as a UUID is not helpful #499

jplatte opened this issue Nov 23, 2020 · 2 comments · Fixed by #505

Comments

@jplatte
Copy link
Contributor

jplatte commented Nov 23, 2020

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.

@KodrAus
Copy link
Member

KodrAus commented Dec 21, 2020

This sounds like a nice improvement to me! Would you be happy to submit a PR @jplatte?

@jplatte
Copy link
Contributor Author

jplatte commented Dec 21, 2020

Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants