Handle weird non-string errors from gun

This commit is contained in:
Daniel Lugo 2021-06-10 16:47:45 -04:00
parent 79e569c322
commit 33f889c831

View file

@ -205,7 +205,13 @@ const put = async (rawPath, value) => {
await makePromise((res, rej) => { await makePromise((res, rej) => {
node.put(/** @type {ValidDataValue} */ (theValue), ack => { node.put(/** @type {ValidDataValue} */ (theValue), ack => {
if (ack.err && typeof ack.err !== 'number') { 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 { } else {
res() res()
} }