Encode exception type and path in string

This commit is contained in:
Kenneth Geisshirt 2017-09-19 14:16:15 +02:00
parent c3b81c768d
commit abe0781565
2 changed files with 6 additions and 6 deletions

View File

@ -253,14 +253,14 @@ public:
};
private:
static void translateSharedGroupOpenException(ContextType ctx, realm::Realm::Config& originalConfiguration) {
static void translateSharedGroupOpenException() {
try {
throw;
}
catch (RealmFileException const& ex) {
switch (ex.kind()) {
case RealmFileException::Kind::IncompatibleSyncedRealm: {
throw IncompatibleSyncedRealmException<T>(ctx, ex.path(), originalConfiguration.encryption_key);
throw std::runtime_error("IncompatibleSyncedRealm: "+ ex.path());
default:
throw;
}
@ -503,7 +503,7 @@ SharedRealm RealmClass<T>::create_shared_realm(ContextType ctx, realm::Realm::Co
realm = realm::Realm::get_shared_realm(config);
}
catch (...) {
translateSharedGroupOpenException(ctx, config);
translateSharedGroupOpenException();
}
GlobalContextType global_context = Context<T>::get_global_context(ctx);
@ -719,7 +719,7 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType,
realm = realm::Realm::get_shared_realm(config);
}
catch (...) {
translateSharedGroupOpenException(ctx, config);
translateSharedGroupOpenException();
}
if (auto sync_config = config.sync_config)

View File

@ -469,8 +469,8 @@ module.exports = {
const realm = new Realm(config);
}
catch (e) {
if (e instanceof IncompatibleSyncedRealmException) {
backupConfig = e.config();
if (e.match('/IncompatibleSyncedRealm: /')) {
const backupConfig = { config: e.substring('IncompatibleSyncedRealm: '.length), sync: { user, url: 'realm:://localhost:9080/~/sync-1.x' } };
const backupRealm = new Realm(backupConfig);
TestCase.assertNotEqual(backupRealm.objects('Person').length, 0);
resolve();