diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2020-01-14 18:11:02 +0100 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2020-01-14 18:11:02 +0100 |
commit | 62d37c8d4e7d1caca21f23978198b721efc5973b (patch) | |
tree | cae2b5f81bb1245caef37cba80f934878978878c /src/error.rs | |
parent | 528e56a0ff759ea81b61eea368cf53b5540dc89a (diff) | |
parent | 43664ca3c449008e2859feb94e3142db3fa98625 (diff) | |
download | nitrokey-rs-62d37c8d4e7d1caca21f23978198b721efc5973b.tar.gz nitrokey-rs-62d37c8d4e7d1caca21f23978198b721efc5973b.tar.bz2 |
Merge branch 'release-0.5.0'
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), } } |