aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,