Repository navigation
Conversation
Allow easily wrapping errors with context before bubbling them up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the process of trying to remove panics I realized it needs to be easy to wrap existing errors with some context that could be used for debugging while keeping the code easy to read and from a practical point of view fast to write. This PR aims to make it easier by adding a
XlsxErrorContexttrait for the error type similar to the one inanyhowthat will make it easy to convert options and errors into our error type.I started to appreciate the magnitude of the changes today. There are 65 errors that show up when I change the return type of
unescape_xml_textto a Result. I'd really prefer not but as far as I can understand the function is intrinsically fallible. There are multiple ways in which it can fail and all of them depend on the input being valid which we can't control. I don't see a way not to bubble that up if we want to remove panics.umya-spreadsheet/src/helper/utils.rs
Line 19 in 55ca059
Lets see if this Trait is acceptable before I start on
unescape_xml_textbecause I think that will be a fairly big PR on it's own.Would also love feedback on if you see another way to handle
unescape_xml_textwithout introducing a result.