Commit 4fb58291 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #164 from ethereum/traceFailedToLoad

Display msg if tx not found
parents e7ef7f4f 61d544dd
...@@ -87,5 +87,8 @@ ...@@ -87,5 +87,8 @@
"test/resources/*" "test/resources/*"
], ],
"parser": "babel-eslint" "parser": "babel-eslint"
},
"browserify": {
"transform": ["babelify"]
} }
} }
...@@ -81,4 +81,18 @@ DropdownPanel.prototype.toggle = function () { ...@@ -81,4 +81,18 @@ DropdownPanel.prototype.toggle = function () {
} }
} }
DropdownPanel.prototype.hide = function () {
if (this.view) {
var el = this.view.querySelector('.dropdownpanel')
el.style.display = 'none'
}
}
DropdownPanel.prototype.show = function () {
if (this.view) {
var el = this.view.querySelector('.dropdownpanel')
el.style.display = ''
}
}
module.exports = DropdownPanel module.exports = DropdownPanel
...@@ -33,11 +33,16 @@ function TxBrowser (_parent) { ...@@ -33,11 +33,16 @@ function TxBrowser (_parent) {
// invokation: 0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51 // invokation: 0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51
TxBrowser.prototype.setDefaultValues = function () { TxBrowser.prototype.setDefaultValues = function () {
this.blockNumber = null this.blockNumber = ''
this.txNumber = ''
this.connectInfo = '' this.connectInfo = ''
this.basicPanel.data = {} this.basicPanel.data = {}
this.basicPanel.update() this.basicPanel.update()
this.basicPanel.hide()
this.updateWeb3Url(util.web3.currentProvider.host) this.updateWeb3Url(util.web3.currentProvider.host)
if (this.view) {
yo.update(this.view, this.render())
}
} }
TxBrowser.prototype.submit = function () { TxBrowser.prototype.submit = function () {
...@@ -57,30 +62,31 @@ TxBrowser.prototype.submit = function () { ...@@ -57,30 +62,31 @@ TxBrowser.prototype.submit = function () {
}) })
} }
} catch (e) { } catch (e) {
console.log(e) self.update(e.message)
} }
} }
TxBrowser.prototype.update = function (error, tx) { TxBrowser.prototype.update = function (error, tx) {
if (error) {
console.log(error)
return
}
var info = {} var info = {}
if (tx) { if (error) {
if (!tx.to) { this.view.querySelector('#error').innerHTML = error
tx.to = traceHelper.contractCreationToken('0')
}
info.from = tx.from
info.to = tx.to
info.hash = tx.hash
this.event.trigger('newTraceRequested', [this.blockNumber, this.txNumber, tx])
} else { } else {
var mes = '<not found>' if (tx) {
info.from = mes this.view.querySelector('#error').innerHTML = ''
info.to = mes if (!tx.to) {
info.hash = mes tx.to = traceHelper.contractCreationToken('0')
console.log('cannot find ' + this.blockNumber + ' ' + this.txNumber) }
info.from = tx.from
info.to = tx.to
info.hash = tx.hash
this.event.trigger('newTraceRequested', [this.blockNumber, this.txNumber, tx])
} else {
var mes = '<not found>'
info.from = mes
info.to = mes
info.hash = mes
this.view.querySelector('#error').innerHTML = 'Cannot find transaction with reference. Block number: ' + this.blockNumber + '. Transaction index/hash: ' + this.txNumber
}
} }
this.basicPanel.data = info this.basicPanel.data = info
this.basicPanel.update() this.basicPanel.update()
...@@ -151,6 +157,7 @@ TxBrowser.prototype.render = function () { ...@@ -151,6 +157,7 @@ TxBrowser.prototype.render = function () {
<button id='load' class='fa fa-play' title='start debugging' onclick=${function () { self.submit() }} style=${ui.formatCss(style.button)}> <button id='load' class='fa fa-play' title='start debugging' onclick=${function () { self.submit() }} style=${ui.formatCss(style.button)}>
</button> </button>
<button id='unload' class='fa fa-stop' title='stop debugging' onclick=${function () { self.unload() }} style=${ui.formatCss(style.button)}></button> <button id='unload' class='fa fa-stop' title='stop debugging' onclick=${function () { self.unload() }} style=${ui.formatCss(style.button)}></button>
<span id='error'></span>
<div style=${ui.formatCss(style.transactionInfo)} id='txinfo'> <div style=${ui.formatCss(style.transactionInfo)} id='txinfo'>
${this.basicPanel.render()} ${this.basicPanel.render()}
</div> </div>
......
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