summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-07-08 22:22:10 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-07-08 23:02:56 +0200
commit3f402dc13530ce4de167bae843200cfbd72ed69b (patch)
tree86633578d61850d38c1fb0ab20ed45bd4a6219c2
parent98232c7bc262dd3902b8f3e299196ab9c83fb355 (diff)
downloadnitrokey-rs-3f402dc13530ce4de167bae843200cfbd72ed69b.tar.gz
nitrokey-rs-3f402dc13530ce4de167bae843200cfbd72ed69b.tar.bz2
Remove Error::RandError variant
Since we update rand_os to version 0.2 in commit 6c138eaa850c745b97b7e48a201db0cbaad8e1e0, the random number generation can no longer fail. Therefore the Error::RandError variant is no longer needed. As we did not want to break the public API, we still kept the RandError variant. This patch removes the RandError variant for good.
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/error.rs4
2 files changed, 1 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dddccb1..651a50e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ SPDX-License-Identifier: CC0-1.0
# Unreleased
- Refactor the `Error` enum so that it is `Send`, `Sync` and `'static`:
- Remove the `sync::PoisonError` from the `PoisonError` variant.
+ - Remove `Error::RandError` variant.
# v0.6.0 (2020-02-03)
- Add `String` value to the `Error::UnexpectedError` variant.
diff --git a/src/error.rs b/src/error.rs
index e0698a2..995741b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -22,8 +22,6 @@ pub enum Error {
LibraryError(LibraryError),
/// An error that occurred due to a poisoned lock.
PoisonError,
- /// An error that occurred during random number generation.
- RandError(Box<dyn error::Error>),
/// An error that is caused by an unexpected value returned by libnitrokey.
UnexpectedError(String),
/// An unknown error returned by libnitrokey.
@@ -101,7 +99,6 @@ impl error::Error for Error {
Error::ConcurrentAccessError => None,
Error::LibraryError(ref err) => Some(err),
Error::PoisonError => None,
- Error::RandError(ref err) => Some(err.as_ref()),
Error::UnexpectedError(_) => None,
Error::UnknownError(_) => None,
Error::UnsupportedModelError => None,
@@ -118,7 +115,6 @@ impl fmt::Display for Error {
Error::ConcurrentAccessError => write!(f, "Internal error: concurrent access"),
Error::LibraryError(ref err) => write!(f, "Library error: {}", err),
Error::PoisonError => write!(f, "Internal error: poisoned lock"),
- Error::RandError(ref err) => write!(f, "RNG error: {}", err),
Error::UnexpectedError(ref s) => write!(f, "An unexpected error occurred: {}", s),
Error::UnknownError(ref err) => write!(f, "Unknown error: {}", err),
Error::UnsupportedModelError => write!(f, "Unsupported Nitrokey model"),