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

Separate the error types #31

Open
svartalf opened this issue Jun 3, 2019 · 0 comments
Open

Separate the error types #31

svartalf opened this issue Jun 3, 2019 · 0 comments
Labels
A-battery Area: battery crate A-battery-ffi Area: battery-ffi crate C-enhancement New feature or request
Milestone

Comments

@svartalf
Copy link
Owner

svartalf commented Jun 3, 2019

This battop issue had introduced the case, when the Battery struct instance can represent the missing device. While it is possible now to handle that case (see #29), this kind of error seems to be a recoverable type of error for library users (mostly to the battop at the moment), because it can be handled (for example, by removing the device from the batteries list).

battery::Error can be reworked as an enum with the "recoverable" and "non-recoverable" members, smth like this:

enum Error {
    /// Battery device is missing now
    Gone(io::Error),
    /// Some error happened during the information fetch
    Other(io::Error),
}
@svartalf svartalf added C-enhancement New feature or request A-battery Area: battery crate A-battery-ffi Area: battery-ffi crate labels Jun 3, 2019
@svartalf svartalf added this to the v0.8 milestone Jun 3, 2019
davidkna pushed a commit to davidkna/rust-battery that referenced this issue Jul 31, 2023
Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](Swatinem/rust-cache@v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-battery Area: battery crate A-battery-ffi Area: battery-ffi crate C-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant