mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-23 21:10:01 +00:00
Realm.open and Realm.openAsync should try/catch opening the realm
and pass the error on to the promise and callback respectively so that it can be handled by the caller
This commit is contained in:
parent
1e58351ace
commit
b1d23bb782
@ -49,9 +49,13 @@ module.exports = function(realmConstructor) {
|
||||
reject(error);
|
||||
}
|
||||
|
||||
let syncedRealm = new realmConstructor(config);
|
||||
//FIXME: RN hangs here. Remove when node's makeCallback alternative is implemented
|
||||
setTimeout(() => { resolve(syncedRealm); }, 1);
|
||||
try {
|
||||
let syncedRealm = new this(config);
|
||||
//FIXME: RN hangs here. Remove when node's makeCallback alternative is implemented
|
||||
setTimeout(() => { resolve(syncedRealm); }, 1);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -62,9 +66,13 @@ module.exports = function(realmConstructor) {
|
||||
callback(error);
|
||||
}
|
||||
|
||||
let syncedRealm = new realmConstructor(config);
|
||||
//FIXME: RN hangs here. Remove when node's makeCallback alternative is implemented
|
||||
setTimeout(() => { callback(null, syncedRealm); }, 1);
|
||||
try {
|
||||
let syncedRealm = new this(config);
|
||||
//FIXME: RN hangs here. Remove when node's makeCallback alternative is implemented
|
||||
setTimeout(() => { callback(null, syncedRealm); }, 1);
|
||||
} catch (e) {
|
||||
callback(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user