1
- import {
1
+ import type {
2
2
BrowserOptions ,
3
- captureException ,
4
3
Event ,
5
- init ,
6
- Integrations ,
7
4
SeverityLevel ,
8
- StackFrame ,
9
- withScope ,
5
+ // StackFrame,
10
6
} from '@sentry/browser' ;
11
- import { RewriteFrames } from '@sentry/integrations' ;
7
+ // import { RewriteFrames } from '@sentry/integrations';
12
8
import { EventHint , Exception } from '@sentry/types' ;
13
9
14
10
import {
@@ -40,19 +36,19 @@ export enum SeverityLevelEnum {
40
36
41
37
export default class SentryErrorLogger implements ErrorLogger {
42
38
private consoleLogger : ErrorLogger ;
43
- private publicPath : string ;
39
+ // private publicPath: string;
44
40
45
41
constructor ( config : BrowserOptions , options ?: SentryErrorLoggerOptions ) {
46
42
const {
47
43
consoleLogger = new NoopErrorLogger ( ) ,
48
- publicPath = '' ,
44
+ // publicPath = '',
49
45
sampleRate = 0.1 ,
50
46
} = options || { } ;
51
47
52
48
this . consoleLogger = consoleLogger ;
53
- this . publicPath = publicPath ;
49
+ // this.publicPath = publicPath;
54
50
55
- init ( {
51
+ Sentry . init ( {
56
52
sampleRate,
57
53
beforeSend : this . handleBeforeSend ,
58
54
denyUrls : [
@@ -61,13 +57,15 @@ export default class SentryErrorLogger implements ErrorLogger {
61
57
'sentry~checkout' ,
62
58
] ,
63
59
integrations : [
64
- new Integrations . GlobalHandlers ( {
60
+ /*
61
+ new Sentry.Integrations.GlobalHandlers({
65
62
onerror: false,
66
63
onunhandledrejection: true,
67
64
}),
68
65
new RewriteFrames({
69
66
iteratee: this.handleRewriteFrame,
70
67
}),
68
+ */
71
69
] ,
72
70
...config ,
73
71
} ) ;
@@ -81,7 +79,7 @@ export default class SentryErrorLogger implements ErrorLogger {
81
79
) : void {
82
80
this . consoleLogger . log ( error , tags , level ) ;
83
81
84
- withScope ( ( scope ) => {
82
+ Sentry . withScope ( ( scope ) => {
85
83
const { errorCode = computeErrorCode ( error ) } = tags || { } ;
86
84
87
85
if ( errorCode ) {
@@ -96,7 +94,7 @@ export default class SentryErrorLogger implements ErrorLogger {
96
94
97
95
scope . setFingerprint ( [ '{{ default }}' ] ) ;
98
96
99
- captureException ( error ) ;
97
+ Sentry . captureException ( error ) ;
100
98
} ) ;
101
99
}
102
100
@@ -162,6 +160,7 @@ export default class SentryErrorLogger implements ErrorLogger {
162
160
return event ;
163
161
} ;
164
162
163
+ /*
165
164
private handleRewriteFrame: (frame: StackFrame) => StackFrame = (frame) => {
166
165
if (this.publicPath && frame.filename) {
167
166
// We want to remove the base path of the filename, otherwise we
@@ -178,4 +177,5 @@ export default class SentryErrorLogger implements ErrorLogger {
178
177
179
178
return frame;
180
179
};
180
+ */
181
181
}
0 commit comments