diff options
author | Daniel Mueller <deso@posteo.net> | 2019-07-17 19:14:03 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-07-17 19:14:03 -0700 |
commit | ef47e3f21498ec886508a344d7c0d5f739117a84 (patch) | |
tree | bf391dc273148494989edbeed0df5bbb79b372eb /nitrocli/src/tests/mod.rs | |
parent | 04bf10c88cea1e92db096407a7f89890f3598969 (diff) | |
download | nitrocli-ef47e3f21498ec886508a344d7c0d5f739117a84.tar.gz nitrocli-ef47e3f21498ec886508a344d7c0d5f739117a84.tar.bz2 |
Update nitrokey crate to 0.4.0-alpha.0
This is patch marks the first step in the process of updating the
nitrokey dependency to version 0.4. In particular, it integrates with
the first alpha version.
The main change on the nitrocli side accompanying the version bump is
that the nitrokey::CommandError got replaced by a more general
nitrokey::Error which includes the former variant.
Import subrepo nitrokey/:nitrokey at d433189caefe6bd6c88da7fbb1d6e9304353eb83
Diffstat (limited to 'nitrocli/src/tests/mod.rs')
-rw-r--r-- | nitrocli/src/tests/mod.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nitrocli/src/tests/mod.rs b/nitrocli/src/tests/mod.rs index c823f52..0e5d8bc 100644 --- a/nitrocli/src/tests/mod.rs +++ b/nitrocli/src/tests/mod.rs @@ -54,6 +54,8 @@ pub trait UnwrapError { fn unwrap_str_err(self) -> String; /// Unwrap a Error::CommandError variant. fn unwrap_cmd_err(self) -> (Option<&'static str>, nitrokey::CommandError); + /// Unwrap a Error::LibraryError variant. + fn unwrap_lib_err(self) -> (Option<&'static str>, nitrokey::LibraryError); } impl<T> UnwrapError for crate::Result<T> @@ -69,7 +71,20 @@ where fn unwrap_cmd_err(self) -> (Option<&'static str>, nitrokey::CommandError) { match self.unwrap_err() { - crate::Error::CommandError(ctx, err) => (ctx, err), + crate::Error::NitrokeyError(ctx, err) => match err { + nitrokey::Error::CommandError(err) => (ctx, err), + err => panic!("Unexpected error variant found: {:?}", err), + }, + err => panic!("Unexpected error variant found: {:?}", err), + } + } + + fn unwrap_lib_err(self) -> (Option<&'static str>, nitrokey::LibraryError) { + match self.unwrap_err() { + crate::Error::NitrokeyError(ctx, err) => match err { + nitrokey::Error::LibraryError(err) => (ctx, err), + err => panic!("Unexpected error variant found: {:?}", err), + }, err => panic!("Unexpected error variant found: {:?}", err), } } |