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

Provision for application errors in ElementWriter::write_inner_content #619

Closed
harmic opened this issue Jun 27, 2023 · 1 comment · Fixed by #652
Closed

Provision for application errors in ElementWriter::write_inner_content #619

harmic opened this issue Jun 27, 2023 · 1 comment · Fixed by #652

Comments

@harmic
Copy link

harmic commented Jun 27, 2023

write_inner_content is defined like this:

pub fn write_inner_content<F>(self, closure: F) -> Result<&'a mut Writer<W>>
where
    F: FnOnce(&mut Writer<W>) -> Result<()>,

This means that the closure can only return errors defined by quick_xml.

At present there doesn't seem to be any option within quick_xml::Error for wrapping an application generated error, so my options are limited if I want to bubble up some internal error.

One solution would be to provide another error variant, CustomError<dyn Box<std::error::Error>>, and ideally also provide a From implementation along with it so that ? can do its magic.

@Mingun
Copy link
Collaborator

Mingun commented Jun 27, 2023

I think, that we generally need to review our Error and DeError types because they looks random and inconsistent. It will be good to address this issue during that redesign.

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