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
29db61ff
Unverified
Commit
29db61ff
authored
May 16, 2023
by
Vignesh Mohankumar
Committed by
GitHub
May 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: filter error caused by missing meta tags (#6546)
* fix: filter error caused by missing meta tags * fix
parent
8431ad91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
errors.test.ts
src/tracing/errors.test.ts
+16
-0
errors.ts
src/tracing/errors.ts
+7
-0
No files found.
src/tracing/errors.test.ts
View file @
29db61ff
...
@@ -187,4 +187,20 @@ describe('beforeSend', () => {
...
@@ -187,4 +187,20 @@ describe('beforeSend', () => {
const
originalException
=
new
DOMException
(
'
The user aborted a request.
'
,
'
AbortError
'
)
const
originalException
=
new
DOMException
(
'
The user aborted a request.
'
,
'
AbortError
'
)
expect
(
beforeSend
(
ERROR
,
{
originalException
})).
toBeNull
()
expect
(
beforeSend
(
ERROR
,
{
originalException
})).
toBeNull
()
})
})
describe
(
'
meta tags
'
,
()
=>
{
it
(
'
filters apple-mobile-web-app-title errors
'
,
()
=>
{
const
originalException
=
new
TypeError
(
"
null is not an object (evaluating 'document.querySelector('meta[name=
\"
apple-mobile-web-app-title
\"
]').content')
"
)
expect
(
beforeSend
(
ERROR
,
{
originalException
})).
toBeNull
()
})
it
(
'
filters og:site_name errors
'
,
()
=>
{
const
originalException
=
new
TypeError
(
"
null is not an object (evaluating 'document.querySelector('meta[name=
\"
og:site_name
\"
]').content')
"
)
expect
(
beforeSend
(
ERROR
,
{
originalException
})).
toBeNull
()
})
})
})
})
src/tracing/errors.ts
View file @
29db61ff
...
@@ -113,6 +113,13 @@ function shouldRejectError(error: EventHint['originalException']) {
...
@@ -113,6 +113,13 @@ function shouldRejectError(error: EventHint['originalException']) {
return
true
return
true
}
}
// Filters out errors caused by checking for meta tags that may not exist.
if
(
error
.
message
.
match
(
/null is not an object
\(
evaluating 'document
\.
querySelector
\(
'meta
\[[^\]]
+
\]
'
\)\.
content'
\)
/
)
)
{
return
true
}
// These are caused by user navigation away from the page before a request has finished.
// These are caused by user navigation away from the page before a request has finished.
if
(
error
instanceof
DOMException
&&
error
.
name
===
'
AbortError
'
)
return
true
if
(
error
instanceof
DOMException
&&
error
.
name
===
'
AbortError
'
)
return
true
}
}
...
...
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