aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2018-11-29 19:57:44 +0000
committerAdam Soltys <[email protected]>2018-11-29 19:57:47 +0000
commit99db3f8894c42c417f681e09dd866ae269f25355 (patch)
tree4c005bee7f58c0545d5d2aed3f3ce53b43724c04
parentd050a9b7602518f369e87f6d23d57b5d612a4813 (diff)
downloadcoinos-server-99db3f8894c42c417f681e09dd866ae269f25355.tar.gz
coinos-server-99db3f8894c42c417f681e09dd866ae269f25355.zip
handle invoice error
-rw-r--r--index.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/index.js b/index.js
index e45d01b2..79cb29b9 100644
--- a/index.js
+++ b/index.js
@@ -419,7 +419,14 @@ const l = console.log
})
app.post('/addInvoice', auth, async (req, res) => {
- let invoice = await lnb.addInvoice({ value: req.body.amount })
+ let err = m => res.status(500).send(m)
+
+ let invoice
+ try {
+ invoice = await lnb.addInvoice({ value: req.body.amount })
+ } catch (e) {
+ return err(e.message)
+ }
await db.Payment.create({
user_id: req.user.id,