Commit 459e045e authored by Iuri Matias's avatar Iuri Matias Committed by aniket-engg

refactor getSourceLocationFromVMTraceIndex to a promise

parent 0f4f699d
...@@ -126,8 +126,8 @@ class InternalCallTree { ...@@ -126,8 +126,8 @@ class InternalCallTree {
extractSourceLocation (step) { extractSourceLocation (step) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { this.traceManager.getCurrentCalledAddressAt(step, (error, address) => {
const address = this.traceManager.getCurrentCalledAddressAt(step) if (!error) {
try { try {
this.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, step, this.solidityProxy.contracts).then(resolve).catch((error) => { this.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, step, this.solidityProxy.contracts).then(resolve).catch((error) => {
return reject('InternalCallTree - Cannot retrieve sourcelocation for step ' + step + ' ' + error) return reject('InternalCallTree - Cannot retrieve sourcelocation for step ' + step + ' ' + error)
...@@ -135,10 +135,11 @@ class InternalCallTree { ...@@ -135,10 +135,11 @@ class InternalCallTree {
} catch (error) { } catch (error) {
return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error) return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error)
} }
} catch (error) { } else {
return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error) return reject('InternalCallTree - Cannot retrieve address for step ' + step + ' ' + error)
} }
}) })
})
} }
} }
......
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