aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-17 12:47:52 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-20 21:08:50 +0000
commit5e258d26b55af6bed7c316b1c7ac12e20946702d (patch)
treefee2be71586bef2f1978eb1cf40ef84c8ac6492b /src/util.rs
parent944e1fa0d51e547dde2a9368d2b8431b109f63c4 (diff)
downloadnitrokey-rs-5e258d26b55af6bed7c316b1c7ac12e20946702d.tar.gz
nitrokey-rs-5e258d26b55af6bed7c316b1c7ac12e20946702d.tar.bz2
Refactor library errors into LibraryError enum
Previously, library errors were part of the CommandError enum. As command errors and library errors are two different error types, they should be split into two enums.
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.rs b/src/util.rs
index 3b9904f..2738fce 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -5,7 +5,7 @@ use libc::{c_void, free};
use rand_core::RngCore;
use rand_os::OsRng;
-use crate::error::{CommandError, Error};
+use crate::error::{CommandError, Error, LibraryError};
/// Log level for libnitrokey.
///
@@ -78,7 +78,7 @@ pub fn generate_password(length: usize) -> Result<Vec<u8>, Error> {
}
pub fn get_cstring<T: Into<Vec<u8>>>(s: T) -> Result<CString, Error> {
- CString::new(s).or(Err(CommandError::InvalidString.into()))
+ CString::new(s).or(Err(LibraryError::InvalidString.into()))
}
impl Into<i32> for LogLevel {