Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
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
vicotor
frontend
Commits
130fe7a0
Commit
130fe7a0
authored
Jan 09, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rollbar filter by error class name
parent
9654d8ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
index.tsx
lib/rollbar/index.tsx
+14
-7
utils.ts
lib/rollbar/utils.ts
+7
-0
No files found.
lib/rollbar/index.tsx
View file @
130fe7a0
...
...
@@ -6,7 +6,7 @@ import config from 'configs/app';
import
{
ABSENT_PARAM_ERROR_MESSAGE
}
from
'
lib/errors/throwOnAbsentParamError
'
;
import
{
RESOURCE_LOAD_ERROR_MESSAGE
}
from
'
lib/errors/throwOnResourceLoadError
'
;
import
{
isBot
,
isHeadlessBrowser
,
isNextJsChunkError
,
getRequestInfo
}
from
'
./utils
'
;
import
{
isBot
,
isHeadlessBrowser
,
isNextJsChunkError
,
getRequestInfo
,
getExceptionClass
}
from
'
./utils
'
;
const
feature
=
config
.
features
.
rollbar
;
...
...
@@ -37,16 +37,23 @@ export const clientConfig: Configuration | undefined = feature.isEnabled ? {
return
true
;
}
const
exceptionClass
=
getExceptionClass
(
item
);
const
IGNORED_EXCEPTION_CLASSES
=
[
// these are React errors - "NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."
// they could be caused by browser extensions
// one of the examples - https://github.com/facebook/react/issues/11538
// we can ignore them for now
'
NotFoundError
'
,
];
if
(
exceptionClass
&&
IGNORED_EXCEPTION_CLASSES
.
includes
(
exceptionClass
))
{
return
true
;
}
return
false
;
},
hostSafeList
:
[
config
.
app
.
host
].
filter
(
Boolean
),
ignoredMessages
:
[
// these are React errors - "NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."
// they could be caused by browser extensions
// one of the examples - https://github.com/facebook/react/issues/11538
// we can ignore them for now
'
NotFoundError
'
,
// these are errors that we throw on when make a call to the API
RESOURCE_LOAD_ERROR_MESSAGE
,
ABSENT_PARAM_ERROR_MESSAGE
,
...
...
lib/rollbar/utils.ts
View file @
130fe7a0
import
_get
from
'
lodash/get
'
;
import
type
{
Dictionary
}
from
'
rollbar
'
;
export
function
isBot
(
userAgent
:
string
|
undefined
)
{
...
...
@@ -56,3 +57,9 @@ export function getRequestInfo(item: Dictionary): { url: string } | undefined {
}
return
{
url
:
item
.
request
.
url
};
}
export
function
getExceptionClass
(
item
:
Dictionary
)
{
const
exceptionClass
=
_get
(
item
,
'
body.trace.exception.class
'
);
return
typeof
exceptionClass
===
'
string
'
?
exceptionClass
:
undefined
;
}
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