Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
7e266b4e
Commit
7e266b4e
authored
May 31, 2022
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle potentially undefined `event.extra` field
This issue was noticed after a TypeScript update.
parent
e822ee15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
sentry.js
src/sidebar/util/sentry.js
+3
-0
sentry-test.js
src/sidebar/util/test/sentry-test.js
+2
-2
No files found.
src/sidebar/util/sentry.js
View file @
7e266b4e
...
...
@@ -88,6 +88,9 @@ export function init(config) {
try
{
const
originalErr
=
hint
&&
hint
.
originalException
;
if
(
originalErr
instanceof
Event
)
{
if
(
!
event
.
extra
)
{
event
.
extra
=
{};
}
Object
.
assign
(
event
.
extra
,
{
type
:
originalErr
.
type
,
// @ts-ignore - `detail` is a property of certain event types.
...
...
src/sidebar/util/test/sentry-test.js
View file @
7e266b4e
...
...
@@ -164,7 +164,7 @@ describe('sidebar/util/sentry', () => {
it
(
'extracts metadata from thrown `Event`s'
,
()
=>
{
sentry
.
init
({
dsn
:
'test-dsn'
});
const
beforeSend
=
getBeforeSendHook
();
const
event
=
{
extra
:
{}
};
const
event
=
{};
beforeSend
(
event
,
{
originalException
:
new
CustomEvent
(
'unexpectedevent'
,
{
...
...
@@ -184,7 +184,7 @@ describe('sidebar/util/sentry', () => {
it
(
'ignores errors serializing non-Error exception values'
,
()
=>
{
sentry
.
init
({
dsn
:
'test-dsn'
});
const
beforeSend
=
getBeforeSendHook
();
const
event
=
{
extra
:
{}
};
const
event
=
{};
const
originalException
=
new
CustomEvent
(
'unexpectedevent'
);
Object
.
defineProperty
(
originalException
,
'detail'
,
{
get
:
()
=>
{
...
...
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