diff --git a/diesel/src/db.rs b/diesel/src/db.rs index 78806c27..81c745df 100644 --- a/diesel/src/db.rs +++ b/diesel/src/db.rs @@ -43,12 +43,12 @@ impl Handler for DbExecutor { diesel::insert_into(users) .values(&new_user) .execute(conn) - .expect("Error inserting person"); + .map_err(|_| error::ErrorInternalServerError("Error inserting person"))?; let mut items = users .filter(id.eq(&uuid)) .load::(conn) - .expect("Error loading person"); + .map_err(|_| error::ErrorInternalServerError("Error loading person"))?; Ok(items.pop().unwrap()) }