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

Improve error for byte deserialization #251

Merged

Conversation

geigerzaehler
Copy link
Contributor

We improve the error the error message for deserialization failures of Byte.

We drop the length check because rustc_hex returns an error when the length is not even.

We improve the error the error message for deserialization failures of `Byte`.

We drop the length check because `rustc_hex` returns an error when the length is not even.
} else {
Err(Error::custom("invalid format"))
Err(Error::invalid_value(Unexpected::Str(value), &"0x prefix"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle this will also be displayed if the length is less than 2, but it's strictly better than what we have currently.

@tomusdrw tomusdrw merged commit 858e93d into tomusdrw:master Sep 8, 2019
@tomusdrw
Copy link
Owner

tomusdrw commented Sep 8, 2019

Thanks!

@geigerzaehler geigerzaehler deleted the improved-byte-serialization-error branch September 8, 2019 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants