do not update the treeview if error

pull/7/head
yann300 8 years ago
parent a4a004800b
commit abc2b356fa
  1. 3
      src/solidity/localDecoder.js
  2. 20
      src/ui/SolidityLocals.js
  3. 14
      src/ui/SolidityState.js

@ -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
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory)
this.basicPanel.update(locals)
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
}

Loading…
Cancel
Save