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
103274a2
Commit
103274a2
authored
Jun 21, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log with error input name
parent
bf29aec3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
txExecution.ts
libs/remix-lib/src/execution/txExecution.ts
+10
-4
No files found.
libs/remix-lib/src/execution/txExecution.ts
View file @
103274a2
...
@@ -92,7 +92,7 @@ export function checkVMError (execResult, abi) {
...
@@ -92,7 +92,7 @@ export function checkVMError (execResult, abi) {
const
returnDataHex
=
returnData
.
slice
(
0
,
4
).
toString
(
'hex'
)
const
returnDataHex
=
returnData
.
slice
(
0
,
4
).
toString
(
'hex'
)
let
customError
let
customError
if
(
abi
)
{
if
(
abi
)
{
let
decodedCustomErrorInputs
let
decodedCustomErrorInputs
Clean
for
(
const
item
of
abi
)
{
for
(
const
item
of
abi
)
{
if
(
item
.
type
===
'error'
)
{
if
(
item
.
type
===
'error'
)
{
// ethers doesn't crash anymore if "error" type is specified, but it doesn't extract the errors. see:
// ethers doesn't crash anymore if "error" type is specified, but it doesn't extract the errors. see:
...
@@ -104,16 +104,22 @@ export function checkVMError (execResult, abi) {
...
@@ -104,16 +104,22 @@ export function checkVMError (execResult, abi) {
if
(
!
sign
)
continue
if
(
!
sign
)
continue
if
(
returnDataHex
===
sign
.
replace
(
'0x'
,
''
))
{
if
(
returnDataHex
===
sign
.
replace
(
'0x'
,
''
))
{
customError
=
item
.
name
customError
=
item
.
name
decodedCustomErrorInputs
=
fn
.
decodeFunctionData
(
fn
.
getFunction
(
item
.
name
),
returnData
)
let
functionDesc
=
fn
.
getFunction
(
item
.
name
)
let
decodedCustomErrorInputs
=
fn
.
decodeFunctionData
(
functionDesc
,
returnData
)
decodedCustomErrorInputsClean
=
{}
for
(
const
input
of
functionDesc
.
inputs
)
{
const
v
=
decodedCustomErrorInputs
[
input
.
name
]
decodedCustomErrorInputsClean
[
input
.
name
]
=
v
.
toString
?
v
.
toString
()
:
v
}
break
break
}
}
}
}
}
}
if
(
decodedCustomErrorInputs
)
{
if
(
decodedCustomErrorInputs
Clean
)
{
msg
=
'
\
tThe transaction has been reverted to the initial state.
\
nError provided by the contract:'
msg
=
'
\
tThe transaction has been reverted to the initial state.
\
nError provided by the contract:'
msg
+=
`\n
${
customError
}
`
msg
+=
`\n
${
customError
}
`
msg
+=
'
\
nParameters:'
msg
+=
'
\
nParameters:'
msg
+=
`\n
${
decodedCustomErrorInputs
}
`
msg
+=
`\n
${
JSON
.
stringify
(
decodedCustomErrorInputsClean
,
null
,
' '
)
}
`
}
}
}
}
if
(
!
customError
)
{
if
(
!
customError
)
{
...
...
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