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

refactor buildCallPath

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