aboutsummaryrefslogtreecommitdiff
path: root/src/api/mod.rs
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2019-02-14 02:03:37 +0100
committerDaniel García <[email protected]>2019-02-16 23:07:48 +0100
commita744b9437aac62b54092eb752b4f1d1045550acc (patch)
tree91df2ccf797bc9695c26c0323f95ea43b2b9c946 /src/api/mod.rs
parent6027b969f542b29365875fa78dbf77765b12d290 (diff)
downloadvaultwarden-a744b9437aac62b54092eb752b4f1d1045550acc.tar.gz
vaultwarden-a744b9437aac62b54092eb752b4f1d1045550acc.zip
Implemented multiple U2f keys, key names, and compromised checks
Diffstat (limited to 'src/api/mod.rs')
-rw-r--r--src/api/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs
index 280b2b78..dc4741e1 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -47,10 +47,13 @@ impl NumberOrString {
}
}
- fn into_i32(self) -> Option<i32> {
+ fn into_i32(self) -> ApiResult<i32> {
+ use std::num::ParseIntError as PIE;
match self {
- NumberOrString::Number(n) => Some(n),
- NumberOrString::String(s) => s.parse().ok(),
+ NumberOrString::Number(n) => Ok(n),
+ NumberOrString::String(s) => s
+ .parse()
+ .map_err(|e: PIE| crate::Error::new("Can't convert to number", e.to_string())),
}
}
}