Skip to content
Permalink
Browse files

Simpler error handling

  • Loading branch information...
fhartwig committed Oct 1, 2015
1 parent 44c4815 commit 406641243fcbefeb42169db5058e1d9917252871
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/dal.rs
@@ -25,13 +25,8 @@ pub fn list_passwords(conn: db::PostgresConnection) -> Result<Vec<Password>, Err
}

pub fn create_password(conn: db::PostgresConnection, password: Password) -> Result<(), Error> {
// try! doesn't work somehow
// expected `core::result::Result<(), u64>`, found `u64`
match conn.execute(
conn.execute(
"INSERT INTO passwords VALUES ($1, $2, $3);",
&[&password.id, &password.name, &password.encrypted]
) {
Ok(_) => Ok(()),
Err(e) => Err(e),
}
).map(|_| ())
}

0 comments on commit 4066412

Please sign in to comment.
You can’t perform that action at this time.