Catch previously uncaught error inside CB

This commit is contained in:
Daniel Lugo 2021-07-21 16:16:56 -04:00
parent 879547c101
commit e236cafe05

View file

@ -2725,16 +2725,16 @@ module.exports = async (
: gun
keys.forEach(key => (node = node.get(key)))
return new Promise(res => {
const listener = async data => {
return new Promise((res, rej) => {
const listener = data => {
if (publicKeyForDecryption) {
res(
await GunWriteRPC.deepDecryptIfNeeded(
data,
publicKeyForDecryption,
epubForDecryption
)
GunWriteRPC.deepDecryptIfNeeded(
data,
publicKeyForDecryption,
epubForDecryption
)
.then(res)
.catch(rej)
} else {
res(data)
}