@@ -8,6 +8,10 @@ export class Ember implements Integration {
88 * @inheritDoc
99 */
1010 public name : string = 'Ember' ;
11+ /**
12+ * @inheritDoc
13+ */
14+ public static id : string = 'Ember' ;
1115
1216 /**
1317 * @inheritDoc
@@ -28,18 +32,20 @@ export class Ember implements Integration {
2832 /**
2933 * @inheritDoc
3034 */
31- public install ( ) : void {
35+ public setupOnce ( ) : void {
3236 if ( ! this . Ember ) {
3337 return ;
3438 }
3539
3640 const oldOnError = this . Ember . onerror ;
3741
3842 this . Ember . onerror = ( error : Error ) : void => {
39- withScope ( scope => {
40- this . addIntegrationToSdkInfo ( scope ) ;
41- getCurrentHub ( ) . captureException ( error , { originalException : error } ) ;
42- } ) ;
43+ if ( getCurrentHub ( ) . getIntegration ( Ember ) ) {
44+ withScope ( scope => {
45+ this . addIntegrationToSdkInfo ( scope ) ;
46+ getCurrentHub ( ) . captureException ( error , { originalException : error } ) ;
47+ } ) ;
48+ }
4349
4450 if ( typeof oldOnError === 'function' ) {
4551 oldOnError . call ( this . Ember , error ) ;
@@ -49,17 +55,19 @@ export class Ember implements Integration {
4955 this . Ember . RSVP . on (
5056 'error' ,
5157 ( reason : any ) : void => {
52- const scope = getCurrentHub ( ) . pushScope ( ) ;
53- if ( reason instanceof Error ) {
54- scope . setExtra ( 'context' , 'Unhandled Promise error detected' ) ;
55- this . addIntegrationToSdkInfo ( scope ) ;
56- getCurrentHub ( ) . captureException ( reason , { originalException : reason } ) ;
57- } else {
58- scope . setExtra ( 'reason' , reason ) ;
59- this . addIntegrationToSdkInfo ( scope ) ;
60- captureMessage ( 'Unhandled Promise error detected' ) ;
58+ if ( getCurrentHub ( ) . getIntegration ( Ember ) ) {
59+ const scope = getCurrentHub ( ) . pushScope ( ) ;
60+ if ( reason instanceof Error ) {
61+ scope . setExtra ( 'context' , 'Unhandled Promise error detected' ) ;
62+ this . addIntegrationToSdkInfo ( scope ) ;
63+ getCurrentHub ( ) . captureException ( reason , { originalException : reason } ) ;
64+ } else {
65+ scope . setExtra ( 'reason' , reason ) ;
66+ this . addIntegrationToSdkInfo ( scope ) ;
67+ captureMessage ( 'Unhandled Promise error detected' ) ;
68+ }
69+ getCurrentHub ( ) . popScope ( ) ;
6170 }
62- getCurrentHub ( ) . popScope ( ) ;
6371 } ,
6472 ) ;
6573 }
0 commit comments