Handle weird non-string errors from gun
This commit is contained in:
parent
79e569c322
commit
33f889c831
1 changed files with 7 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue