Commit f8f965ec authored by Iuri Matias's avatar Iuri Matias

fix resolveTrace method

parent d3207060
...@@ -18,10 +18,9 @@ function TraceManager (options) { ...@@ -18,10 +18,9 @@ function TraceManager (options) {
// init section // init section
TraceManager.prototype.resolveTrace = async function (tx) { TraceManager.prototype.resolveTrace = async function (tx) {
return new Promise(async (resolve, reject) => {
this.tx = tx this.tx = tx
this.init() this.init()
if (!this.web3) reject('web3 not loaded') if (!this.web3) throw new Error('web3 not loaded')
this.isLoading = true this.isLoading = true
try { try {
const result = await this.getTrace(tx.hash) const result = await this.getTrace(tx.hash)
...@@ -31,18 +30,17 @@ TraceManager.prototype.resolveTrace = async function (tx) { ...@@ -31,18 +30,17 @@ TraceManager.prototype.resolveTrace = async function (tx) {
this.traceAnalyser.analyse(result.structLogs, tx) this.traceAnalyser.analyse(result.structLogs, tx)
this.isLoading = false this.isLoading = false
return resolve(true) return true
} }
var mes = tx.hash + ' is not a contract invocation or contract creation.' var mes = tx.hash + ' is not a contract invocation or contract creation.'
console.log(mes) console.log(mes)
this.isLoading = false this.isLoading = false
reject(mes) throw new Error(mes)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.isLoading = false this.isLoading = false
reject(error) throw new Error(error)
} }
})
} }
TraceManager.prototype.getTrace = function (txHash) { TraceManager.prototype.getTrace = function (txHash) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment