aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
Commit message (Collapse)AuthorAge
* Add the CommunicationError enumRobin Krahl2019-01-20
| | | | | | Communication errors returned by libnitrokey were previously not mapped to an error type in the nitrokey crate. We introduce the CommunicationError enum to represent these errors.
* Refactor library errors into LibraryError enumRobin Krahl2019-01-20
| | | | | | Previously, library errors were part of the CommandError enum. As command errors and library errors are two different error types, they should be split into two enums.
* Move the CommandError::Unknown to ErrorRobin Krahl2019-01-20
| | | | | | | An error code can not only indiciate a command error, but also a library or device communication error. Therefore, the variant for an unknown error code should be placed in the top-level Error enum instead of the CommandError enum.
* Refactor CommandError::RngError into Error::RandErrorRobin Krahl2019-01-20
| | | | | We reserve CommandError for errors returned by the Nitrokey device. Errors during random number generation should have their own type.
* Return Error instead of CommandErrorRobin Krahl2019-01-20
| | | | | | | | | | This patch changes all public functions to return the Error enum instead of the CommandError enum. This breaks the tests which will be fixed with the next patch. This patch also adds a placeholder variant Error::CommandError and a placeholder enum CommandError to make the transition to a new nitrokey-test version easier.
* Add the Error enum and the Result<T> typedefRobin Krahl2019-01-20
| | | | | The Error enum is a wrapper for the possible error types (currently only CommandError). Result<T> is defined as Result<T, Error>.
* Implement std::error::Error for error::CommandErrorRobin Krahl2019-01-20
|
* Move util::CommandError to the new error moduleRobin Krahl2019-01-20
This prepares the refactoring of util::CommandError into multiple enums.