From 700244e45b2d3f3feab909a206e142b999079624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Fri, 11 Jun 2021 12:00:16 +0100 Subject: [PATCH] refactor: remove duplicated error handling --- lib/plugins.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/plugins.js b/lib/plugins.js index de5e4e21..ea95e272 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -521,8 +521,10 @@ function plugins (settings, deviceId) { execute(settings, tradeEntry, newEntry.id) .catch(err => { updateTradeEntry(tradeEntry, newEntry, err) - .catch(console.log) - throw err + .then(() => { + console.log(err) + throw err + }) }) ) } @@ -531,9 +533,6 @@ function plugins (settings, deviceId) { const data = mergeTradeEntryAndError(tradeEntry, err) const sql = pgp.helpers.update(data, ['error'], 'trades') + ` WHERE id = ${newEntry.id}` return db.none(sql) - .then(() => { - throw err - }) } function recordTradeAndTx (tradeId, { cashInTxs, cashOutTxs }, dbTx) {