fix error feedback

pull/3094/head
yann300 6 years ago
parent f617762b86
commit f35cd1f09c
  1. 16
      src/app/tabs/run-tab.js

@ -392,9 +392,12 @@ function contractDropdown (events, self) {
selectContractNames.addEventListener('change', setInputParamsPlaceHolder) selectContractNames.addEventListener('change', setInputParamsPlaceHolder)
function createInstanceCallback (error, selectedContract, data) { function createInstanceCallback (selectedContract, data) {
if (error) return self._deps.logCallback(`creation of ${selectedContract.name} errored: ` + error)
self._deps.logCallback(`creation of ${selectedContract.name} pending...`) self._deps.logCallback(`creation of ${selectedContract.name} pending...`)
if (data) {
data.contractName = selectedContract.name
data.linkReferences = selectedContract.contract.object.evm.bytecode.linkReferences
}
self._deps.udapp.createContract(data, (error, txResult) => { self._deps.udapp.createContract(data, (error, txResult) => {
if (!error) { if (!error) {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
@ -434,9 +437,8 @@ function contractDropdown (events, self) {
if (error) return self._deps.logCallback(`creation of ${selectedContract.name} errored: ` + error) if (error) return self._deps.logCallback(`creation of ${selectedContract.name} errored: ` + error)
if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) { if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) {
txFormat.buildData(selectedContract.name, selectedContract.contract.object, compiler.getContracts(), true, constructor, args, (error, data) => { txFormat.buildData(selectedContract.name, selectedContract.contract.object, compiler.getContracts(), true, constructor, args, (error, data) => {
data.contractName = selectedContract.name if (error) return self._deps.logCallback(`creation of ${selectedContract.name} errored: ` + error)
data.linkReferences = selectedContract.contract.object.evm.bytecode.linkReferences createInstanceCallback(selectedContract, data)
createInstanceCallback(error, selectedContract, data)
}, (msg) => { }, (msg) => {
self._deps.logCallback(msg) self._deps.logCallback(msg)
}, (data, runTxCallback) => { }, (data, runTxCallback) => {
@ -446,8 +448,8 @@ function contractDropdown (events, self) {
} else { } else {
if (Object.keys(selectedContract.contract.object.evm.bytecode.linkReferences).length) self._deps.logCallback(`linking ${JSON.stringify(selectedContract.contract.object.evm.bytecode.linkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`) if (Object.keys(selectedContract.contract.object.evm.bytecode.linkReferences).length) self._deps.logCallback(`linking ${JSON.stringify(selectedContract.contract.object.evm.bytecode.linkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`)
txFormat.encodeConstructorCallAndLinkLibraries(selectedContract.contract.object, args, constructor, contractMetadata.linkReferences, selectedContract.contract.object.evm.bytecode.linkReferences, (error, data) => { txFormat.encodeConstructorCallAndLinkLibraries(selectedContract.contract.object, args, constructor, contractMetadata.linkReferences, selectedContract.contract.object.evm.bytecode.linkReferences, (error, data) => {
if (data) data.contractName = selectedContract.name if (error) return self._deps.logCallback(`creation of ${selectedContract.name} errored: ` + error)
createInstanceCallback(error, selectedContract, data) createInstanceCallback(selectedContract, data)
}) })
} }
}) })

Loading…
Cancel
Save