aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/transaction-manager.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-03-23 00:48:41 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-03-23 00:48:41 +0800
commit8c7be4340349032655503b4137147e1978b0f0bd (patch)
treed0334e9dc44d2a4d99308c506733046c69928033 /app/scripts/transaction-manager.js
parent046774e76877f8f833445c76e2013d7f2c9bfff3 (diff)
downloadtangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar.gz
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar.bz2
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar.lz
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar.xz
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.tar.zst
tangerine-wallet-browser-8c7be4340349032655503b4137147e1978b0f0bd.zip
Have better error messages
Diffstat (limited to 'app/scripts/transaction-manager.js')
-rw-r--r--app/scripts/transaction-manager.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js
index c6cfdf11d..31c1c8431 100644
--- a/app/scripts/transaction-manager.js
+++ b/app/scripts/transaction-manager.js
@@ -172,7 +172,10 @@ module.exports = class TransactionManager extends EventEmitter {
], (err) => {
self.nonceLock.leave()
if (err) {
- this.setTxStatusFailed(txId)
+ this.setTxStatusFailed(txId, {
+ errCode: err.errCode || err,
+ message: err.message || 'Transaction failed during approval',
+ })
return cb(err)
}
cb()
@@ -291,7 +294,10 @@ module.exports = class TransactionManager extends EventEmitter {
this._setTxStatus(txId, 'confirmed')
}
- setTxStatusFailed (txId) {
+ setTxStatusFailed (txId, reason) {
+ let txMeta = this.getTx(txId)
+ txMeta.err = reason
+ this.updateTx(txMeta)
this._setTxStatus(txId, 'failed')
}
@@ -312,12 +318,11 @@ module.exports = class TransactionManager extends EventEmitter {
var txHash = txMeta.hash
var txId = txMeta.id
if (!txHash) {
- txMeta.err = {
+ let errReason = {
errCode: 'No hash was provided',
message: 'We had an error while submitting this transaction, please try again.',
}
- this.updateTx(txMeta)
- return this.setTxStatusFailed(txId)
+ return this.setTxStatusFailed(txId, errReason)
}
this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => {
if (err || !txParams) {