refactor: remove duplicated error handling

This commit is contained in:
José Oliveira 2021-06-11 12:00:16 +01:00 committed by Josh Harvey
parent 8567b7887c
commit 700244e45b

View file

@ -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) {