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

refactor getSourceLocationFromVMTraceIndex to a promise

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