Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
cleaner exit on common errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ojensen5115 committed Jun 19, 2017
1 parent 77a5306 commit b023674
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,21 @@ fn show_credential(conn: &rusqlite::Connection, name: String) {
}

fn get_credential(conn: &rusqlite::Connection, name: String) -> Credential {
conn.query_row("SELECT * FROM credentials WHERE name = ?1", &[&name], |row| {
match conn.query_row("SELECT * FROM credentials WHERE name = ?1", &[&name], |row| {
Credential {
id: row.get(0),
name: row.get(1),
category: row.get(2),
username: row.get(3),
password: row.get(4)
}
}).expect("No such credential saved.")
}) {
Ok(c) => c,
_ => {
println!("No such credential saved.");
::std::process::exit(1)
}
}
}

fn copy_credential(conn: &rusqlite::Connection, name: String, username: bool) {
Expand Down

0 comments on commit b023674

Please sign in to comment.