Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
ee563829
Unverified
Commit
ee563829
authored
Apr 11, 2023
by
Vignesh Mohankumar
Committed by
GitHub
Apr 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: ignores "user rejected transaction" errors (#6330)
* ignore user rejected errors * test * fix * use util
parent
64e396d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
errors.test.ts
src/tracing/errors.test.ts
+5
-0
errors.ts
src/tracing/errors.ts
+4
-0
No files found.
src/tracing/errors.test.ts
View file @
ee563829
...
@@ -19,4 +19,9 @@ describe('filterKnownErrors', () => {
...
@@ -19,4 +19,9 @@ describe('filterKnownErrors', () => {
const
originalException
=
new
Error
(
'
underlying network changed
'
)
const
originalException
=
new
Error
(
'
underlying network changed
'
)
expect
(
filterKnownErrors
(
ERROR
,
{
originalException
})).
toBe
(
null
)
expect
(
filterKnownErrors
(
ERROR
,
{
originalException
})).
toBe
(
null
)
})
})
it
(
'
filters user rejected request errors
'
,
()
=>
{
const
originalException
=
new
Error
(
'
user rejected transaction
'
)
expect
(
filterKnownErrors
(
ERROR
,
{
originalException
})).
toBe
(
null
)
})
})
})
src/tracing/errors.ts
View file @
ee563829
import
{
ClientOptions
,
ErrorEvent
,
EventHint
}
from
'
@sentry/types
'
import
{
ClientOptions
,
ErrorEvent
,
EventHint
}
from
'
@sentry/types
'
import
{
didUserReject
}
from
'
utils/swapErrorToUserReadableMessage
'
/** Identifies ethers request errors (as thrown by {@type import(@ethersproject/web).fetchJson}). */
/** Identifies ethers request errors (as thrown by {@type import(@ethersproject/web).fetchJson}). */
function
isEthersRequestError
(
error
:
Error
):
error
is
Error
&
{
requestBody
:
string
}
{
function
isEthersRequestError
(
error
:
Error
):
error
is
Error
&
{
requestBody
:
string
}
{
...
@@ -21,6 +22,9 @@ export const filterKnownErrors: Required<ClientOptions>['beforeSend'] = (event:
...
@@ -21,6 +22,9 @@ export const filterKnownErrors: Required<ClientOptions>['beforeSend'] = (event:
// If the error is a network change, it should not be considered an exception.
// If the error is a network change, it should not be considered an exception.
if
(
error
.
message
.
match
(
/underlying network changed/
))
return
null
if
(
error
.
message
.
match
(
/underlying network changed/
))
return
null
// If the error is based on a user rejecting, it should not be considered an exception.
if
(
didUserReject
(
error
))
return
null
}
}
return
event
return
event
...
...
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