Commit 98494c3d authored by Iuri Matias's avatar Iuri Matias Committed by aniket-engg

refactor buildCallPath

parent a2056a49
......@@ -41,11 +41,7 @@ class DebuggerStepManager {
if (index < 0) return
if (this.currentStepIndex !== index) return
this.traceManager.buildCallPath(index, (error, callsPath) => {
if (error) {
console.log(error)
return this.event.trigger('revertWarning', [''])
}
this.traceManager.buildCallPath(index).then((callsPath) => {
this.currentCall = callsPath[callsPath.length - 1]
if (this.currentCall.reverted) {
let revertedReason = this.currentCall.outofgas ? 'outofgas' : ''
......@@ -59,6 +55,9 @@ class DebuggerStepManager {
this.event.trigger('revertWarning', ['parenthasthrown'])
}
this.event.trigger('revertWarning', [''])
}).catch((error) => {
console.log(error)
this.event.trigger('revertWarning', [''])
})
})
}
......
......@@ -101,15 +101,15 @@ TraceManager.prototype.getCallDataAt = function (stepIndex) {
return [this.traceCache.callsData[callDataChange]]
}
TraceManager.prototype.buildCallPath = function (stepIndex, callback) {
TraceManager.prototype.buildCallPath = function (stepIndex) {
try {
this.checkRequestedStep(stepIndex)
} catch (check) {
return callback(check, null)
throw new Error(check)
}
const callsPath = util.buildCallPath(stepIndex, this.traceCache.callsTree.call)
if (callsPath === null) return callback('no call path built', null)
callback(null, callsPath)
if (callsPath === null) throw new Error('no call path built')
return callsPath
}
TraceManager.prototype.getCallStackAt = function (stepIndex) {
......
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