diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2020-01-07 11:45:39 +0100 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2020-01-07 11:45:39 +0100 |
commit | 1532f92de1d63613602acb0b68486361571f3e50 (patch) | |
tree | 816248fbb3cb398f8b98294a14abee3300f14ae7 /src/error.rs | |
parent | e0baabd1046087a9f545d9ef65539c23eb91e85f (diff) | |
parent | 97c772724dd1fe395e7154e0d71c3b2408436082 (diff) | |
download | nitrokey-rs-1532f92de1d63613602acb0b68486361571f3e50.tar.gz nitrokey-rs-1532f92de1d63613602acb0b68486361571f3e50.tar.bz2 |
Merge branch 'connect_path' into next
This patch series adds the list_devices function that returns a list of
available Nitrokey devices and the Manager::connect_path function that
connects to one of the available devices.
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 9e6adc0..f9af594 100644 --- a/src/error.rs +++ b/src/error.rs @@ -28,6 +28,8 @@ pub enum Error { UnexpectedError, /// An unknown error returned by libnitrokey. UnknownError(i64), + /// An error caused by a Nitrokey model that is not supported by this crate. + UnsupportedModelError, /// An error occurred when interpreting a UTF-8 string. Utf8Error(str::Utf8Error), } @@ -102,6 +104,7 @@ impl error::Error for Error { Error::RandError(ref err) => Some(err.as_ref()), Error::UnexpectedError => None, Error::UnknownError(_) => None, + Error::UnsupportedModelError => None, Error::Utf8Error(ref err) => Some(err), } } @@ -118,6 +121,7 @@ impl fmt::Display for Error { Error::RandError(ref err) => write!(f, "RNG error: {}", err), Error::UnexpectedError => write!(f, "An unexpected error occurred"), Error::UnknownError(ref err) => write!(f, "Unknown error: {}", err), + Error::UnsupportedModelError => write!(f, "Unsupported Nitrokey model"), Error::Utf8Error(ref err) => write!(f, "UTF-8 error: {}", err), } } |