Merge pull request #31 from realm/tg-file-not-found

Catch File::NotFound and rethrow correctly
This commit is contained in:
Thomas Goyne 2016-01-07 15:19:21 -08:00
commit 854d6bea53
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() + "'");