From e236cafe052dd7a983af5fa7197602303cf754bb Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 21 Jul 2021 16:16:56 -0400 Subject: [PATCH] Catch previously uncaught error inside CB --- src/routes.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes.js b/src/routes.js index 44b23076..7d6108d3 100644 --- a/src/routes.js +++ b/src/routes.js @@ -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) }