Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
3460f05c
Commit
3460f05c
authored
Aug 17, 2017
by
yann300
Committed by
GitHub
Aug 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #698 from ethereum/warnifvmtxfailed
Alert vm error if any
parents
8c0d3417
67ddb9c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
run-tab.js
src/app/tabs/run-tab.js
+20
-1
No files found.
src/app/tabs/run-tab.js
View file @
3460f05c
...
@@ -273,8 +273,11 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -273,8 +273,11 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
if
(
!
error
)
{
if
(
!
error
)
{
txExecution
.
createContract
(
data
,
appAPI
.
udapp
(),
(
error
,
txResult
)
=>
{
txExecution
.
createContract
(
data
,
appAPI
.
udapp
(),
(
error
,
txResult
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
var
isVM
=
appAPI
.
executionContext
().
isVM
()
if
(
isVM
&&
alertVMErrorIfAny
(
txResult
))
return
noInstancesText
.
style
.
display
=
'none'
noInstancesText
.
style
.
display
=
'none'
var
address
=
appAPI
.
executionContext
().
isVM
()
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
var
address
=
isVM
?
txResult
.
result
.
createdAddress
:
txResult
.
result
.
contractAddress
instanceContainer
.
appendChild
(
appAPI
.
udapp
().
renderInstance
(
contract
,
address
,
selectContractNames
.
value
))
instanceContainer
.
appendChild
(
appAPI
.
udapp
().
renderInstance
(
contract
,
address
,
selectContractNames
.
value
))
}
else
{
}
else
{
modalDialogCustom
.
alert
(
error
)
modalDialogCustom
.
alert
(
error
)
...
@@ -286,6 +289,22 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -286,6 +289,22 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
})
})
}
}
function
alertVMErrorIfAny
(
txResult
)
{
if
(
!
txResult
.
result
.
vm
.
exceptionError
)
{
return
null
}
var
error
=
yo
`<span> VM error:
${
txResult
.
result
.
vm
.
exceptionError
}
</span>`
var
msg
if
(
txResult
.
result
.
vm
.
exceptionError
===
'invalid opcode'
)
{
msg
=
yo
`<ul><li>The constructor should be payable if you send it value.</li>
<li>The execution might have thrown.</li></ul>`
}
else
if
(
txResult
.
result
.
vm
.
exceptionError
===
'out of gas'
)
{
msg
=
yo
`<div>The transaction ran out of gas. Please increase the Gas Limit.</div>`
}
modalDialogCustom
.
alert
(
yo
`<div>
${
error
}
${
msg
}
Debug the transaction to get more information</div>`
)
return
error
+
msg
}
function
loadFromAddress
(
appAPI
)
{
function
loadFromAddress
(
appAPI
)
{
noInstancesText
.
style
.
display
=
'none'
noInstancesText
.
style
.
display
=
'none'
var
contractNames
=
document
.
querySelector
(
`.
${
css
.
contractNames
.
classNames
[
0
]}
`
)
var
contractNames
=
document
.
querySelector
(
`.
${
css
.
contractNames
.
classNames
[
0
]}
`
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment