db/simple: handle Database::Open() exceptions in Mount()

This commit is contained in:
Max Kellermann 2016-03-18 18:55:54 +01:00
parent dfb3e34f7b
commit 8167bdd978
1 changed files with 7 additions and 2 deletions

View File

@ -471,9 +471,14 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri,
auto db = new SimpleDatabase(AllocatedPath::Build(cache_path,
name_fs.c_str()),
compress);
if (!db->Open(error)) {
try {
if (!db->Open(error)) {
delete db;
return false;
}
} catch (...) {
delete db;
return false;
throw;
}
// TODO: update the new database instance?