mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
Don't panic on DB error
This commit is contained in:
parent
02b8850cdf
commit
84c1087de0
@ -43,12 +43,12 @@ impl Handler<CreateUser> 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::<models::User>(conn)
|
||||
.expect("Error loading person");
|
||||
.map_err(|_| error::ErrorInternalServerError("Error loading person"))?;
|
||||
|
||||
Ok(items.pop().unwrap())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user