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

Better errors #22

Open
vjoki opened this issue Jan 6, 2020 · 0 comments
Open

Better errors #22

vjoki opened this issue Jan 6, 2020 · 0 comments

Comments

@vjoki
Copy link
Contributor

vjoki commented Jan 6, 2020

Refactoring UnrarError seems necessary as there's a need for errors on the Rust side of things, and abusing the FFI error codes for that is quite problematic. There seems to be room for some other improvements as well.

Some ideas for changes:

  • Move some of the error::Code logic to types within unrar_sys, for example RARReadHeader could return something like enum ReadResult {..} with the relevant Codes.
  • The type parameter for the data type in UnrarError makes it kind of unwieldy, and should be removed.

Additionally it could be nice to have the error type(s) implement std::error::Error, either manually or by using something like thiserror. There's a nice survey on the current state of error handling in Rust, in case you're interested in using a library for this.

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

1 participant