From 33f889c8312d05ab48ae6a0f188d41bc1d5bd05c Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Thu, 10 Jun 2021 16:47:45 -0400 Subject: [PATCH] Handle weird non-string errors from gun --- services/gunDB/rpc/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/gunDB/rpc/index.js b/services/gunDB/rpc/index.js index b9ef24a1..a255e5c2 100644 --- a/services/gunDB/rpc/index.js +++ b/services/gunDB/rpc/index.js @@ -205,7 +205,13 @@ const put = async (rawPath, value) => { await makePromise((res, rej) => { node.put(/** @type {ValidDataValue} */ (theValue), ack => { if (ack.err && typeof ack.err !== 'number') { - rej(new Error(ack.err)) + if (typeof ack.err === 'string') { + rej(new Error(ack.err)) + } else { + console.log(`NON STANDARD GUN ERROR:`) + console.log(ack) + rej(new Error(JSON.stringify(ack.err, null, 4))) + } } else { res() }