Skip to content

Commit 35d84e0

Browse files
committed
polish(shared): Clean up browser.ts
1 parent efe9436 commit 35d84e0

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

libs/shared/sentry-browser/src/lib/browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function captureException(err: Error) {
3535
);
3636
}
3737
});
38+
3839
Sentry.captureException(err);
3940
});
4041
}

libs/shared/sentry/src/lib/browser.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ describe('sentry/browser', () => {
5656
it('works without request url', () => {
5757
const data = {
5858
key: 'value',
59-
} as Sentry.Event;
59+
type: undefined,
60+
} as Sentry.ErrorEvent;
6061

6162
const resultData = sentryWrapper.beforeSend(config, data, {});
6263

@@ -65,13 +66,14 @@ describe('sentry/browser', () => {
6566

6667
it('fingerprints errno', () => {
6768
const data = {
69+
type: undefined,
6870
request: {
6971
url: 'https://example.com',
7072
},
7173
tags: {
7274
errno: '100',
7375
},
74-
} as Sentry.Event;
76+
} as Sentry.ErrorEvent;
7577

7678
const resultData = sentryWrapper.beforeSend(config, data, {});
7779
expect(resultData?.fingerprint?.[0]).toEqual('errno100');
@@ -100,7 +102,7 @@ describe('sentry/browser', () => {
100102

101103
it('will return null from before send when disabled', () => {
102104
sentryWrapper.disable();
103-
expect(sentryWrapper.beforeSend({}, {}, {})).toBeNull();
105+
expect(sentryWrapper.beforeSend({}, { type: undefined }, {})).toBeNull();
104106
});
105107
});
106108
});

libs/shared/sentry/src/lib/browser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function captureException(err: Error) {
3434
);
3535
}
3636
});
37-
_Sentry.captureException(err);
37+
Sentry.captureException(err);
3838
});
3939
}
4040

@@ -67,7 +67,7 @@ export function enable() {
6767
*/
6868
export function beforeSend(
6969
opts: SentryConfigOpts,
70-
event: Sentry.Event,
70+
event: Sentry.ErrorEvent,
7171
_hint?: Sentry.EventHint
7272
) {
7373
if (sentryEnabled === false) {

0 commit comments

Comments
 (0)