Skip to content

Panic removal - Add helper trait for error type - #426

Open
c-git wants to merge 3 commits into
MathNya:masterfrom
c-git:panic-removal
Open

c-git wants to merge 3 commits into
MathNya:masterfrom
c-git:panic-removal

Conversation

@c-git

@c-git c-git commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

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 XlsxErrorContext trait for the error type similar to the one in anyhow that 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_text to 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.

pub(crate) fn unescape_xml_text(e: &quick_xml::events::BytesText<'_>) -> String {

Lets see if this Trait is acceptable before I start on unescape_xml_text because 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_text without introducing a result.

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.

1 participant