refactor: remove duplicated error handling
This commit is contained in:
parent
8567b7887c
commit
700244e45b
1 changed files with 4 additions and 5 deletions
|
|
@ -521,9 +521,11 @@ function plugins (settings, deviceId) {
|
||||||
execute(settings, tradeEntry, newEntry.id)
|
execute(settings, tradeEntry, newEntry.id)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
updateTradeEntry(tradeEntry, newEntry, err)
|
updateTradeEntry(tradeEntry, newEntry, err)
|
||||||
.catch(console.log)
|
.then(() => {
|
||||||
|
console.log(err)
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -531,9 +533,6 @@ function plugins (settings, deviceId) {
|
||||||
const data = mergeTradeEntryAndError(tradeEntry, err)
|
const data = mergeTradeEntryAndError(tradeEntry, err)
|
||||||
const sql = pgp.helpers.update(data, ['error'], 'trades') + ` WHERE id = ${newEntry.id}`
|
const sql = pgp.helpers.update(data, ['error'], 'trades') + ` WHERE id = ${newEntry.id}`
|
||||||
return db.none(sql)
|
return db.none(sql)
|
||||||
.then(() => {
|
|
||||||
throw err
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordTradeAndTx (tradeId, { cashInTxs, cashOutTxs }, dbTx) {
|
function recordTradeAndTx (tradeId, { cashInTxs, cashOutTxs }, dbTx) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue