Encode exception type and path in string
This commit is contained in:
parent
c3b81c768d
commit
abe0781565
|
@ -253,14 +253,14 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void translateSharedGroupOpenException(ContextType ctx, realm::Realm::Config& originalConfiguration) {
|
static void translateSharedGroupOpenException() {
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (RealmFileException const& ex) {
|
catch (RealmFileException const& ex) {
|
||||||
switch (ex.kind()) {
|
switch (ex.kind()) {
|
||||||
case RealmFileException::Kind::IncompatibleSyncedRealm: {
|
case RealmFileException::Kind::IncompatibleSyncedRealm: {
|
||||||
throw IncompatibleSyncedRealmException<T>(ctx, ex.path(), originalConfiguration.encryption_key);
|
throw std::runtime_error("IncompatibleSyncedRealm: "+ ex.path());
|
||||||
default:
|
default:
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,7 @@ SharedRealm RealmClass<T>::create_shared_realm(ContextType ctx, realm::Realm::Co
|
||||||
realm = realm::Realm::get_shared_realm(config);
|
realm = realm::Realm::get_shared_realm(config);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
translateSharedGroupOpenException(ctx, config);
|
translateSharedGroupOpenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalContextType global_context = Context<T>::get_global_context(ctx);
|
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);
|
realm = realm::Realm::get_shared_realm(config);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
translateSharedGroupOpenException(ctx, config);
|
translateSharedGroupOpenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto sync_config = config.sync_config)
|
if (auto sync_config = config.sync_config)
|
||||||
|
|
|
@ -469,8 +469,8 @@ module.exports = {
|
||||||
const realm = new Realm(config);
|
const realm = new Realm(config);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e instanceof IncompatibleSyncedRealmException) {
|
if (e.match('/IncompatibleSyncedRealm: /')) {
|
||||||
backupConfig = e.config();
|
const backupConfig = { config: e.substring('IncompatibleSyncedRealm: '.length), sync: { user, url: 'realm:://localhost:9080/~/sync-1.x' } };
|
||||||
const backupRealm = new Realm(backupConfig);
|
const backupRealm = new Realm(backupConfig);
|
||||||
TestCase.assertNotEqual(backupRealm.objects('Person').length, 0);
|
TestCase.assertNotEqual(backupRealm.objects('Person').length, 0);
|
||||||
resolve();
|
resolve();
|
||||||
|
|
Loading…
Reference in New Issue