aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2018-04-05 03:29:37 +0000
committerAdam Soltys <[email protected]>2018-04-05 03:29:37 +0000
commitfee5f4d0453ec9c8bd57f1d64ae2abee2b316783 (patch)
treedef2000ba557fd9ff7043bc7a3d7e9537e8c2864 /index.js
parentabd58592aece5a6483395fabcf57104efc75023c (diff)
downloadcoinos-server-fee5f4d0453ec9c8bd57f1d64ae2abee2b316783.tar.gz
coinos-server-fee5f4d0453ec9c8bd57f1d64ae2abee2b316783.zip
nicer error messages
Diffstat (limited to 'index.js')
-rw-r--r--index.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/index.js b/index.js
index d6278dae..ac91bada 100644
--- a/index.js
+++ b/index.js
@@ -234,13 +234,19 @@ const l = console.log
channel.on('error', err => {
l('channel error', peer, err)
- if (err.message.startsWith('Multiple')) {
+ let msg = err.message
+
+ if (msg.startsWith('Multiple')) {
busypeers.push(peer)
peer = lna.channelpeers.find(p => !busypeers.includes(p))
return openchannel(peer, amount)
}
- return res.status(500).send(err.message)
+ if (msg.startsWith('not enough')) {
+ msg = 'Server wallet is busy. Wait for a block and try again'
+ }
+
+ return res.status(500).send(msg)
})
}
@@ -307,7 +313,9 @@ const l = console.log
})
stream.on('error', e => {
- res.status(500).send(e.message)
+ let msg = e.message
+
+ res.status(500).send(msg)
})
})
@@ -353,7 +361,13 @@ const l = console.log
res.send({ txid, tx, amount, fees })
} catch (e) {
l(e)
- res.status(500).send(e.message)
+ let msg = e.message
+
+ if (msg.startsWith('insufficient')) {
+ msg = 'Server wallet is busy. Wait a block and try again'
+ }
+
+ res.status(500).send(msg)
}
})