Catch File::NotFound and rethrow correctly

This commit is contained in:
Marius Rackwitz 2015-12-01 12:54:32 +01:00 committed by Thomas Goyne
parent e8a26aa533
commit 7e96fa9732
1 changed files with 4 additions and 0 deletions

View File

@ -84,6 +84,10 @@ Realm::Realm(Config config)
throw RealmFileException(RealmFileException::Kind::Exists, ex.get_path(), throw RealmFileException(RealmFileException::Kind::Exists, ex.get_path(),
"File at path '" + ex.get_path() + "' already exists."); "File at path '" + ex.get_path() + "' already exists.");
} }
catch (util::File::NotFound const& ex) {
throw RealmFileException(RealmFileException::Kind::NotFound, ex.get_path(),
"File at path '" + ex.get_path() + "' does not exist.");
}
catch (util::File::AccessError const& ex) { catch (util::File::AccessError const& ex) {
throw RealmFileException(RealmFileException::Kind::AccessError, ex.get_path(), throw RealmFileException(RealmFileException::Kind::AccessError, ex.get_path(),
"Unable to open a realm at path '" + ex.get_path() + "'"); "Unable to open a realm at path '" + ex.get_path() + "'");