db/simple: throw DatabaseError on error

This commit is contained in:
Max Kellermann
2016-02-28 11:19:28 +01:00
parent de938eb621
commit 5b8dce7456
3 changed files with 34 additions and 41 deletions

View File

@@ -237,9 +237,14 @@ handle_mount(Client &client, Request args, Response &r)
if (_db != nullptr && _db->IsPlugin(simple_db_plugin)) {
SimpleDatabase &db = *(SimpleDatabase *)_db;
if (!db.Mount(local_uri, remote_uri, error)) {
try {
if (!db.Mount(local_uri, remote_uri, error)) {
composite.Unmount(local_uri);
return print_error(r, error);
}
} catch (...) {
composite.Unmount(local_uri);
return print_error(r, error);
throw;
}
// TODO: call Instance::OnDatabaseModified()?