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

Decoding errors unclear #15

Open
rendaw opened this issue Oct 9, 2019 · 2 comments
Open

Decoding errors unclear #15

rendaw opened this issue Oct 9, 2019 · 2 comments

Comments

@rendaw
Copy link

rendaw commented Oct 9, 2019

If base64 decode fails this produces an error message like:

Error reading config [config.json]: Invalid byte 43, offset 68. at line 2 column 1608

which is unclear on 2 points:

  1. Invalid byte refers to an invalid base64 character and not an invalid json byte - but it's not clear what state the parser was in when the error was raised
  2. The invalid byte 43 is neither at offset 68 into the file (that's the offset into the string value) nor at line 2 column 1608 (that's the end of the string value which is where serde points the error to)

Some of these are caused by the rather terse error message from the base64 crate, but making this a bit more verbose like "Failed to parse base64 value: Invalid byte... in string ending at line 2...." would be a lot more clear I think.

Getting the actual offset would be triply nice, not sure how doable that is though.

@marshallpierce
Copy link
Owner

Ah, so wrapping base64 errors in this crate (ideally with proper offset info, though I don't think serde makes that available) to make their provenance more clear?

@rendaw
Copy link
Author

rendaw commented Oct 13, 2019

Yeah, that would be great IMO if it's possible. I was mostly thinking of the confusion from an end user perspective (well, and me at the time) and I think there's not enough information available for the serde using code to separate/provide a clearer error message.

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

No branches or pull requests

2 participants