aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nitrocli/src/commands.rs')
-rw-r--r--nitrocli/src/commands.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/nitrocli/src/commands.rs b/nitrocli/src/commands.rs
index f8765cc..ed3c2c4 100644
--- a/nitrocli/src/commands.rs
+++ b/nitrocli/src/commands.rs
@@ -34,8 +34,8 @@ use crate::pinentry;
use crate::Result;
/// Create an `error::Error` with an error message of the format `msg: err`.
-fn get_error(msg: &str, err: nitrokey::CommandError) -> Error {
- Error::Error(format!("{}: {}", msg, err))
+fn get_error(msg: &'static str, err: nitrokey::CommandError) -> Error {
+ Error::CommandError(Some(msg), err)
}
/// Set `libnitrokey`'s log level based on the execution context's verbosity.
@@ -201,8 +201,7 @@ where
data = new_data;
continue;
}
- let error = format!("{}: Wrong password", msg);
- return Err(Error::Error(error));
+ return Err(get_error(msg, err));
}
err => return Err(get_error(msg, err)),
},