diff --git a/libs/remix-debug/src/debugger/VmDebugger.js b/libs/remix-debug/src/debugger/VmDebugger.js index e3d24e04a5..2536e3cd28 100644 --- a/libs/remix-debug/src/debugger/VmDebugger.js +++ b/libs/remix-debug/src/debugger/VmDebugger.js @@ -113,9 +113,12 @@ class VmDebuggerLogic { } catch (error) { } - this._traceManager.getCurrentStep(index, (error, step) => { - this.event.trigger('traceCurrentStepUpdate', [error, step]) - }) + try { + const step = this._traceManager.getCurrentStep(index) + this.event.trigger('traceCurrentStepUpdate', [null, step]) + } catch (error) { + this.event.trigger('traceCurrentStepUpdate', [error]) + } try { const addmem = this._traceManager.getMemExpand(index) diff --git a/libs/remix-lib/src/trace/traceManager.js b/libs/remix-lib/src/trace/traceManager.js index 6ef9c8d9af..92fe652523 100644 --- a/libs/remix-lib/src/trace/traceManager.js +++ b/libs/remix-lib/src/trace/traceManager.js @@ -200,13 +200,13 @@ TraceManager.prototype.getReturnValue = function (stepIndex) { return this.traceCache.returnValues[stepIndex] } -TraceManager.prototype.getCurrentStep = function (stepIndex, callback) { +TraceManager.prototype.getCurrentStep = function (stepIndex) { try { this.checkRequestedStep(stepIndex) } catch (check) { - return callback(check, null) + throw new Error(check) } - callback(null, this.traceCache.steps[stepIndex]) + return this.traceCache.steps[stepIndex] } TraceManager.prototype.getMemExpand = function (stepIndex) { diff --git a/libs/remix-lib/test/traceManager.js b/libs/remix-lib/test/traceManager.js index a632125cae..83f12b31d6 100644 --- a/libs/remix-lib/test/traceManager.js +++ b/libs/remix-lib/test/traceManager.js @@ -209,15 +209,14 @@ tape('TraceManager', function (t) { }) t.test('TraceManager.getCurrentStep', function (st) { - traceManager.getCurrentStep(66, function (error, result) { + try { + const result = traceManager.getCurrentStep(66) console.log(result) - if (error) { - st.fail(error) - } else { - st.ok(result === 2) - st.end() - } - }) + st.ok(result === 2) + st.end() + } catch (error) { + st.fail(error) + } }) t.test('TraceManager.getMemExpand', function (st) {