rust-battery
rust-battery copied to clipboard
Separate the error types
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),
}