vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit d420992f8cf253c7cb74bcaed3c774ad645b1900
parent c259a0e3e23800347ed90b4a192b44798c3513fb
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Tue, 15 Jan 2019 21:47:16 +0100

Update some function calls to use ?

Diffstat:
Msrc/api/core/ciphers.rs | 2+-
Msrc/api/core/two_factor.rs | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs @@ -690,7 +690,7 @@ fn post_attachment(uuid: String, data: Data, content_type: &ContentType, headers let mut attachment = Attachment::new(file_name, cipher.uuid.clone(), name, size); attachment.key = attachment_key.clone(); - attachment.save(&conn).expect("Error saving attachment"); + attachment.save(&conn)?; } _ => error!("Invalid multipart name"), } diff --git a/src/api/core/two_factor.rs b/src/api/core/two_factor.rs @@ -94,7 +94,7 @@ fn recover(data: JsonUpcase<RecoverTwoFactor>, conn: DbConn) -> JsonResult { // Remove all twofactors from the user for twofactor in TwoFactor::find_by_user(&user.uuid, &conn) { - twofactor.delete(&conn).expect("Error deleting twofactor"); + twofactor.delete(&conn)?; } // Remove the recovery code, not needed without twofactors @@ -123,7 +123,7 @@ fn disable_twofactor(data: JsonUpcase<DisableTwoFactorData>, headers: Headers, c let type_ = data.Type.into_i32().expect("Invalid type"); if let Some(twofactor) = TwoFactor::find_by_user_and_type(&user.uuid, type_, &conn) { - twofactor.delete(&conn).expect("Error deleting twofactor"); + twofactor.delete(&conn)?; } Ok(Json(json!({ @@ -205,7 +205,7 @@ fn activate_authenticator(data: JsonUpcase<EnableAuthenticatorData>, headers: He } _generate_recover_code(&mut user, &conn); - twofactor.save(&conn).expect("Error saving twofactor"); + twofactor.save(&conn)?; Ok(Json(json!({ "Enabled": true,