From 38ba24080dd50b1993772ba822c3db83876c4fd3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 10 May 2021 09:52:46 -0700 Subject: catch liquid send errors --- routes/liquid/send.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'routes') diff --git a/routes/liquid/send.js b/routes/liquid/send.js index a3bb7639..0729370c 100644 --- a/routes/liquid/send.js +++ b/routes/liquid/send.js @@ -67,7 +67,8 @@ sendLiquid = async ({ user, address, memo, tx, limit }) => { } } - if (limit && total > limit) throw new Error("Tx amount exceeds authorized amount"); + if (limit && total > limit) + throw new Error("Tx amount exceeds authorized amount"); if (asset !== btc || total) { l.info("creating liquid payment", user.username, asset, total, fee); @@ -147,13 +148,13 @@ sendLiquid = async ({ user, address, memo, tx, limit }) => { module.exports = ah(async (req, res) => { let { user } = req; - let { address, feeRate, memo, tx } = req.body; - - if (!tx) { - ({ tx } = await liquidTx({ ...req.body, user })); - } try { + let { address, feeRate, memo, tx } = req.body; + + if (!tx) { + ({ tx } = await liquidTx({ ...req.body, user })); + } res.send(await sendLiquid({ user, address, memo, tx })); } catch (e) { l.error("problem sending liquid", user.username, e.message); -- cgit v1.2.3