Show error if can't open/create database

This commit is contained in:
CDrummond 2022-04-06 13:22:30 +01:00
parent 7fb2e66c58
commit 94ef2e2c1f
2 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,7 @@
-----
1. Tidy up code, thanks to Serial-ATA
2. Update version of tag reader library, should now support ID3v2 in FLAC.
3. Show error message if can't open, or create, database file.
0.1.0
-----

View File

@ -51,8 +51,16 @@ pub struct Db {
impl Db {
pub fn new(path: &String) -> Self {
Self {
conn: Connection::open(path).unwrap(),
match Connection::open(path) {
Ok(conn) => {
Self {
conn: conn,
}
}
Err(e) => {
log::error!("Failed top open/create database. {}", e);
process::exit(-1);
}
}
}