Commit abc2b356 authored by yann300's avatar yann300

do not update the treeview if error

parent a4a00480
......@@ -3,7 +3,8 @@
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
var scope = internalTreeCall.findScope(vmtraceIndex)
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 = {}
memory = formatMemory(memory)
......
......@@ -16,18 +16,26 @@ class SolidityLocals {
extractData: solidityTypeFormatter.extractData
})
this.init()
this.view
}
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 () {
this.parent.event.register('indexChanged', this, (index) => {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) {
this.basicPanel.update({info: 'invalid step index'})
warningDiv.innerHTML = 'invalid step index'
return
}
if (this.parent.currentStepIndex !== index) return
this.traceManager.waterfall([
......@@ -38,8 +46,12 @@ class SolidityLocals {
if (!error) {
var stack = result[0].value
var memory = result[1].value
try {
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) {
extractData: solidityTypeFormatter.extractData
})
this.init()
this.view
}
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 () {
var self = this
this.parent.event.register('indexChanged', this, function (index) {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) {
self.basicPanel.update({info: 'invalid step index'})
warningDiv.innerHTML = 'invalid step index'
return
}
if (self.parent.currentStepIndex !== index) return
if (!this.solidityProxy.loaded()) {
self.basicPanel.update({info: 'no source has been specified'})
warningDiv.innerHTML = 'no source has been specified'
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