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 : gun
keys.forEach(key => (node = node.get(key))) keys.forEach(key => (node = node.get(key)))
return new Promise(res => { return new Promise((res, rej) => {
const listener = async data => { const listener = data => {
if (publicKeyForDecryption) { if (publicKeyForDecryption) {
res( GunWriteRPC.deepDecryptIfNeeded(
await GunWriteRPC.deepDecryptIfNeeded( data,
data, publicKeyForDecryption,
publicKeyForDecryption, epubForDecryption
epubForDecryption
)
) )
.then(res)
.catch(rej)
} else { } else {
res(data) res(data)
} }