@@ -2,54 +2,58 @@ import * as Sentry from '@sentry/browser';
2
2
import { CaptureConsole , Dedupe , Ember } from '@sentry/integrations' ;
3
3
import config from 'open-event-frontend/config/environment' ;
4
4
5
- Sentry . init ( {
6
- integrations : [
7
- new Ember ( ) ,
8
- new Dedupe ( ) ,
9
- new CaptureConsole ( {
10
- levels : [ 'error' ]
11
- } )
12
- ] ,
13
- beforeSend ( event : Sentry . Event ) {
14
- const exception = event . exception ?. values ?. [ 0 ] ;
15
- const errorValue = exception ?. value ;
16
- if ( errorValue ?. includes ( "Ember Data Request" ) ) {
17
- if ( errorValue ?. includes ( "404" ) ) {
18
- // Ignore 404 errors from Ember Data because
19
- // I don't know how to turn them off
5
+ if ( ! config . sentry . dsn . includes ( 'dummy' ) ) {
6
+
7
+ Sentry . init ( {
8
+ integrations : [
9
+ new Ember ( ) ,
10
+ new Dedupe ( ) ,
11
+ new CaptureConsole ( {
12
+ levels : [ 'error' ]
13
+ } )
14
+ ] ,
15
+ beforeSend ( event : Sentry . Event ) {
16
+ const exception = event . exception ?. values ?. [ 0 ] ;
17
+ const errorValue = exception ?. value ;
18
+ if ( errorValue ?. includes ( "Ember Data Request" ) ) {
19
+ if ( errorValue ?. includes ( "404" ) ) {
20
+ // Ignore 404 errors from Ember Data because
21
+ // I don't know how to turn them off
22
+ return null ;
23
+ }
24
+ }
25
+
26
+ if ( errorValue ?. includes ( "TransitionAborted" ) &&
27
+ exception ?. mechanism ?. handled ) {
28
+ // Every page load has a handled TransitionAborted for some reason
20
29
return null ;
21
30
}
22
- }
23
31
24
- if ( errorValue ?. includes ( "TransitionAborted" ) &&
25
- exception ?. mechanism ?. handled ) {
26
- // Every page load has a handled TransitionAborted for some reason
27
- return null ;
28
- }
32
+ return event ;
33
+ } ,
34
+ ...config . sentry
35
+ } ) ;
29
36
30
- return event ;
31
- } ,
32
- ...config . sentry
33
- } ) ;
34
-
35
- Sentry . configureScope ( function ( scope ) {
36
- function addAdapterError ( error : any , event : Sentry . Event ) {
37
- if ( error . isAdapterError ) {
38
- event . extra = {
39
- ...event . extra ,
40
- adapter_errors : error . errors ,
41
- adapter_errors_json : JSON . stringify ( error . errors )
37
+ Sentry . configureScope ( function ( scope ) {
38
+ function addAdapterError ( error : any , event : Sentry . Event ) {
39
+ if ( error . isAdapterError ) {
40
+ event . extra = {
41
+ ...event . extra ,
42
+ adapter_errors : error . errors ,
43
+ adapter_errors_json : JSON . stringify ( error . errors )
44
+ }
42
45
}
43
46
}
44
- }
45
47
46
- scope . addEventProcessor ( function ( event : Sentry . Event , hints : Sentry . EventHint ) {
47
- addAdapterError ( hints . originalException , event ) ;
48
+ scope . addEventProcessor ( function ( event : Sentry . Event , hints : Sentry . EventHint ) {
49
+ addAdapterError ( hints . originalException , event ) ;
48
50
49
- const args : any [ ] = event . extra ?. arguments || [ ] ;
50
- for ( const arg of args ) {
51
- addAdapterError ( arg , event ) ;
52
- }
53
- return event ;
51
+ const args : any [ ] = event . extra ?. arguments || [ ] ;
52
+ for ( const arg of args ) {
53
+ addAdapterError ( arg , event ) ;
54
+ }
55
+ return event ;
56
+ } ) ;
54
57
} ) ;
55
- } ) ;
58
+
59
+ }
0 commit comments