aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-05-10 09:52:46 -0700
committerAdam Soltys <[email protected]>2021-05-10 09:52:48 -0700
commit38ba24080dd50b1993772ba822c3db83876c4fd3 (patch)
treef12d4d0eccaf336c118967ced5870770be496145
parent0699395e6fbba4e61e08305d15123a1e7dfa29dc (diff)
downloadcoinos-server-38ba24080dd50b1993772ba822c3db83876c4fd3.tar.gz
coinos-server-38ba24080dd50b1993772ba822c3db83876c4fd3.zip
catch liquid send errors
-rw-r--r--index.js1
-rw-r--r--routes/liquid/send.js13
2 files changed, 7 insertions, 7 deletions
diff --git a/index.js b/index.js
index 1178c71b..7304862f 100644
--- a/index.js
+++ b/index.js
@@ -96,7 +96,6 @@ app.use((err, req, res, next) => {
"Cache-Control": "no-cache"
});
res.send(err.message);
- return res.end();
});
server.listen(config.port, () =>
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);