diff options
author | Anton <anton@chainsecurity.com> | 2018-05-29 04:57:08 +0800 |
---|---|---|
committer | Anton <anton@chainsecurity.com> | 2018-05-29 04:57:08 +0800 |
commit | 71a6e97327a4c759942784ee81505e3bc5ed545e (patch) | |
tree | a7ac713e5b2f0cd700d3e55203ec56ce089a2414 /app/scripts/controllers | |
parent | 1d23a5c81b03b8b52225e942603c84b237d4e63c (diff) | |
download | dexon-wallet-71a6e97327a4c759942784ee81505e3bc5ed545e.tar.gz dexon-wallet-71a6e97327a4c759942784ee81505e3bc5ed545e.tar.zst dexon-wallet-71a6e97327a4c759942784ee81505e3bc5ed545e.zip |
cleanErrorStack moved to separate library module
more errors traces cleaned up
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 6609b80b..aff5db98 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -8,6 +8,7 @@ const TxGasUtil = require('./tx-gas-utils') const PendingTransactionTracker = require('./pending-tx-tracker') const NonceTracker = require('./nonce-tracker') const txUtils = require('./lib/util') +const cleanErrorStack = require('../../lib/cleanErrorStack') const log = require('loglevel') /** @@ -112,15 +113,6 @@ class TransactionController extends EventEmitter { } /** - Returns error without stack trace for better UI display - @param {Error} err - error which stack will be cleaned - */ - cleanErrorStack(err){ - err.stack = err.name + ': ' + err.message - return err - } - - /** add a new unapproved transaction to the pipeline @returns {Promise<string>} the hash of the transaction after being submitted to the network @@ -140,11 +132,11 @@ class TransactionController extends EventEmitter { case 'submitted': return resolve(finishedTxMeta.hash) case 'rejected': - return reject(this.cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.'))) + return reject(cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.'))) case 'failed': - return reject(this.cleanErrorStack(new Error(finishedTxMeta.err.message))) + return reject(cleanErrorStack(new Error(finishedTxMeta.err.message))) default: - return reject(this.cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`))) + return reject(cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`))) } }) }) |