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
c0297d9d
Unverified
Commit
c0297d9d
authored
Apr 24, 2018
by
yann300
Committed by
GitHub
Apr 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #760 from ethereum/revert-reason
Display reason for revert (Solidity 0.4.22 feature)
parents
19275236
44b09989
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
txExecution.js
remix-lib/src/execution/txExecution.js
+15
-6
No files found.
remix-lib/src/execution/txExecution.js
View file @
c0297d9d
'use strict'
var
ethJSABI
=
require
(
'ethereumjs-abi'
)
module
.
exports
=
{
/**
...
...
@@ -72,22 +73,30 @@ module.exports = {
if
(
!
txResult
.
result
.
vm
.
exceptionError
)
{
return
ret
}
var
error
=
`VM error:
${
txResult
.
result
.
vm
.
exceptionError
}
.\n`
var
exceptionError
=
txResult
.
result
.
vm
.
exceptionError
.
error
||
''
var
error
=
`VM error:
${
exceptionError
}
.\n`
var
msg
if
(
txResult
.
result
.
vm
.
exceptionError
===
errorCode
.
INVALID_OPCODE
)
{
if
(
exceptionError
===
errorCode
.
INVALID_OPCODE
)
{
msg
=
`\t\n\tThe execution might have thrown.\n`
ret
.
error
=
true
}
else
if
(
txResult
.
result
.
vm
.
exceptionError
===
errorCode
.
OUT_OF_GAS
)
{
}
else
if
(
exceptionError
===
errorCode
.
OUT_OF_GAS
)
{
msg
=
`\tThe transaction ran out of gas. Please increase the Gas Limit.\n`
ret
.
error
=
true
}
else
if
(
txResult
.
result
.
vm
.
exceptionError
===
errorCode
.
REVERT
)
{
}
else
if
(
exceptionError
===
errorCode
.
REVERT
)
{
var
returnData
=
txResult
.
result
.
vm
.
return
// It is the hash of Error(string)
if
(
returnData
&&
(
returnData
.
slice
(
0
,
4
).
toString
(
'hex'
)
===
'08c379a0'
))
{
var
reason
=
ethJSABI
.
rawDecode
([
'string'
],
returnData
.
slice
(
4
))[
0
]
msg
=
`\tThe transaction has been reverted to the initial state.\nReason provided by the contract: "
${
reason
}
".`
}
else
{
msg
=
`\tThe transaction has been reverted to the initial state.\nNote: The constructor should be payable if you send value.`
}
ret
.
error
=
true
}
else
if
(
txResult
.
result
.
vm
.
exceptionError
===
errorCode
.
STATIC_STATE_CHANGE
)
{
}
else
if
(
exceptionError
===
errorCode
.
STATIC_STATE_CHANGE
)
{
msg
=
`\tState changes is not allowed in Static Call context\n`
ret
.
error
=
true
}
ret
.
message
=
`
${
error
}${
txResult
.
result
.
vm
.
exceptionError
}${
msg
}
\tDebug the transaction to get more information.`
ret
.
message
=
`
${
error
}${
exceptionError
}${
msg
}
\tDebug the transaction to get more information.`
return
ret
}
}
...
...
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