summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-14 18:11:02 +0100
committerRobin Krahl <robin.krahl@ireas.org>2020-01-14 18:11:02 +0100
commit62d37c8d4e7d1caca21f23978198b721efc5973b (patch)
treecae2b5f81bb1245caef37cba80f934878978878c /src/error.rs
parent528e56a0ff759ea81b61eea368cf53b5540dc89a (diff)
parent43664ca3c449008e2859feb94e3142db3fa98625 (diff)
downloadnitrokey-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.rs4
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),
}
}