aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-09-25 19:08:47 -0400
committerAdam Soltys <[email protected]>2020-10-01 03:18:48 -0400
commitf0f4532a8f8d5dbdec4d27f635494b925752f43e (patch)
tree14f777b9e68c9596eec55bb1e93dd29fd040bf87
parentcd3977c1c8fedecbb344f774024c91a66be054de (diff)
downloadcoinos-server-f0f4532a8f8d5dbdec4d27f635494b925752f43e.tar.gz
coinos-server-f0f4532a8f8d5dbdec4d27f635494b925752f43e.zip
better invoice error handling
-rw-r--r--routes/invoices.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/routes/invoices.js b/routes/invoices.js
index b70dcbbe..11d62eb6 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -15,6 +15,7 @@ app.get("/invoice", auth, ah(async (req, res, next) => {
}));
app.post("/invoice", ah(async (req, res, next) => {
+ try {
let { invoice, user } = req.body;
if (!user) ({ user } = req);
else {
@@ -35,7 +36,6 @@ app.post("/invoice", ah(async (req, res, next) => {
invoice.amount,
invoice.tip,
invoice.currency,
- invoice.rate.toFixed(2)
);
if (invoice.network === "liquid") {
@@ -60,4 +60,8 @@ app.post("/invoice", ah(async (req, res, next) => {
addresses[invoice.address] = user.username;
if (invoice.unconfidential) addresses[invoice.unconfidential] = user.username;
res.send(invoice);
+ } catch(e) {
+ l.error(e.message, e.stack);
+ res.status(500).send(`Problem during invoice creation: ${e.message}`);
+ }
}));