From 99db3f8894c42c417f681e09dd866ae269f25355 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 29 Nov 2018 19:57:44 +0000 Subject: handle invoice error --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3