From d420992f8cf253c7cb74bcaed3c774ad645b1900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 15 Jan 2019 21:47:16 +0100 Subject: [PATCH] Update some function calls to use ? --- src/api/core/ciphers.rs | 2 +- src/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 index 1168a0f7..0cfcd201 100644 --- 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 index 15dcac8a..cac3e9f9 100644 --- a/src/api/core/two_factor.rs +++ b/src/api/core/two_factor.rs @@ -94,7 +94,7 @@ fn recover(data: JsonUpcase, 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, 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, headers: He } _generate_recover_code(&mut user, &conn); - twofactor.save(&conn).expect("Error saving twofactor"); + twofactor.save(&conn)?; Ok(Json(json!({ "Enabled": true,