diff --git a/src/js_realm.hpp b/src/js_realm.hpp index df58a3ac..7761a595 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -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(ctx, ex.path(), originalConfiguration.encryption_key); + throw std::runtime_error("IncompatibleSyncedRealm: "+ ex.path()); default: throw; } @@ -503,7 +503,7 @@ SharedRealm RealmClass::create_shared_realm(ContextType ctx, realm::Realm::Co realm = realm::Realm::get_shared_realm(config); } catch (...) { - translateSharedGroupOpenException(ctx, config); + translateSharedGroupOpenException(); } GlobalContextType global_context = Context::get_global_context(ctx); @@ -719,7 +719,7 @@ void RealmClass::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) diff --git a/tests/js/session-tests.js b/tests/js/session-tests.js index c1ea30c8..56d634a5 100644 --- a/tests/js/session-tests.js +++ b/tests/js/session-tests.js @@ -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();