Commit abc2b356 authored by yann300's avatar yann300

do not update the treeview if error

parent a4a00480
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) { function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
var scope = internalTreeCall.findScope(vmtraceIndex) var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) { if (!scope) {
return { 'error': 'Can\'t display locals. reason: compilation result might not have been provided' } var error = { 'message': 'Can\'t display locals. reason: compilation result might not have been provided' }
throw error
} }
var locals = {} var locals = {}
memory = formatMemory(memory) memory = formatMemory(memory)
......
...@@ -16,20 +16,28 @@ class SolidityLocals { ...@@ -16,20 +16,28 @@ class SolidityLocals {
extractData: solidityTypeFormatter.extractData extractData: solidityTypeFormatter.extractData
}) })
this.init() this.init()
this.view
} }
render () { render () {
return yo`<div id='soliditylocals' >${this.basicPanel.render()}</div>` this.view = yo`<div id='soliditylocals' >
<div id='warning'></div>
${this.basicPanel.render()}
</div>`
return this.view
} }
init () { init () {
this.parent.event.register('indexChanged', this, (index) => { this.parent.event.register('indexChanged', this, (index) => {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) { if (index < 0) {
this.basicPanel.update({info: 'invalid step index'}) warningDiv.innerHTML = 'invalid step index'
return return
} }
if (this.parent.currentStepIndex !== index) return if (this.parent.currentStepIndex !== index) return
this.traceManager.waterfall([ this.traceManager.waterfall([
this.traceManager.getStackAt, this.traceManager.getStackAt,
this.traceManager.getMemoryAt], this.traceManager.getMemoryAt],
...@@ -38,8 +46,12 @@ class SolidityLocals { ...@@ -38,8 +46,12 @@ class SolidityLocals {
if (!error) { if (!error) {
var stack = result[0].value var stack = result[0].value
var memory = result[1].value var memory = result[1].value
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory) try {
this.basicPanel.update(locals) var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory)
this.basicPanel.update(locals)
} catch (e) {
warningDiv.innerHTML = e.message
}
} }
}) })
}) })
......
...@@ -15,22 +15,30 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) { ...@@ -15,22 +15,30 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
extractData: solidityTypeFormatter.extractData extractData: solidityTypeFormatter.extractData
}) })
this.init() this.init()
this.view
} }
SolidityState.prototype.render = function () { SolidityState.prototype.render = function () {
return yo`<div id='soliditystate' >${this.basicPanel.render()}</div>` this.view = yo`<div id='soliditystate' >
<div id='warning'></div>
${this.basicPanel.render()}
</div>`
return this.view
} }
SolidityState.prototype.init = function () { SolidityState.prototype.init = function () {
var self = this var self = this
this.parent.event.register('indexChanged', this, function (index) { this.parent.event.register('indexChanged', this, function (index) {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) { if (index < 0) {
self.basicPanel.update({info: 'invalid step index'}) warningDiv.innerHTML = 'invalid step index'
return return
} }
if (self.parent.currentStepIndex !== index) return if (self.parent.currentStepIndex !== index) return
if (!this.solidityProxy.loaded()) { if (!this.solidityProxy.loaded()) {
self.basicPanel.update({info: 'no source has been specified'}) warningDiv.innerHTML = 'no source has been specified'
return return
} }
......
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