From 10b2c85db1d3c985ec0bf9ed4395d23edc13691c Mon Sep 17 00:00:00 2001 From: keyan Date: Wed, 9 Jun 2021 15:07:32 -0500 Subject: [PATCH] log invoice creation error --- api/resolvers/wallet.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 3589a572..ff4e3e7d 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -62,26 +62,31 @@ export default { // set expires at to 3 hours into future const expiresAt = new Date(new Date().setHours(new Date().getHours() + 3)) const description = `${amount} sats for @${me.name} on stacker.news` - const invoice = await createInvoice({ - description, - lnd, - tokens: amount, - expires_at: expiresAt - }) + try { + const invoice = await createInvoice({ + description, + lnd, + tokens: amount, + expires_at: expiresAt + }) - const data = { - hash: invoice.id, - bolt11: invoice.request, - expiresAt: expiresAt, - msatsRequested: amount * 1000, - user: { - connect: { - name: me.name + const data = { + hash: invoice.id, + bolt11: invoice.request, + expiresAt: expiresAt, + msatsRequested: amount * 1000, + user: { + connect: { + name: me.name + } } } - } - return await models.invoice.create({ data }) + return await models.invoice.create({ data }) + } catch (error) { + console.log(error) + throw error + } }, createWithdrawl: async (parent, { invoice, maxFee }, { me, models, lnd }) => { if (!me) {