1
- import { runInDebug } from '@ember/debug' ;
2
-
3
- import * as Sentry from '@sentry/browser' ;
4
- import { getGlobalObject , isInstanceOf , logger } from '@sentry/utils' ;
1
+ import * as Sentry from '@sentry/ember' ;
5
2
6
3
import config from './config/environment' ;
7
4
8
5
export function init ( ) {
9
- let integrations = [ ] ;
10
- if ( config . environment === 'production' ) {
11
- integrations . push ( new Ember ( ) ) ;
12
- }
13
-
14
6
let isProd = location . hostname === 'crates.io' ;
15
7
let isStaging = location . hostname === 'staging.crates.io' ;
16
8
let environment = isProd ? 'production' : isStaging ? 'staging' : 'unknown' ;
17
9
18
10
Sentry . init ( {
19
11
environment,
20
12
...config . sentry ,
21
- integrations,
22
13
23
14
allowUrls : [ 'crates.io' , 'crates-io.herokuapp.com' , 'staging.crates.io' , 'staging-crates-io.herokuapp.com' ] ,
24
15
@@ -35,50 +26,3 @@ export function init() {
35
26
} ,
36
27
} ) ;
37
28
}
38
-
39
- export class Ember {
40
- static id = 'Ember' ;
41
-
42
- name = Ember . id ;
43
- _Ember ;
44
-
45
- constructor ( options = { } ) {
46
- this . _Ember = options . Ember || getGlobalObject ( ) . Ember ;
47
- }
48
-
49
- setupOnce ( _ , getCurrentHub ) {
50
- if ( ! this . _Ember ) {
51
- runInDebug ( ( ) => logger . error ( 'EmberIntegration is missing an Ember instance' ) ) ;
52
- return ;
53
- }
54
-
55
- const oldOnError = this . _Ember . onerror ;
56
-
57
- // eslint-disable-next-line unicorn/prefer-add-event-listener
58
- this . _Ember . onerror = error => {
59
- if ( getCurrentHub ( ) . getIntegration ( Ember ) ) {
60
- getCurrentHub ( ) . captureException ( error , { originalException : error } ) ;
61
- }
62
-
63
- if ( typeof oldOnError === 'function' ) {
64
- oldOnError . call ( this . _Ember , error ) ;
65
- } else if ( this . _Ember . testing ) {
66
- throw error ;
67
- }
68
- } ;
69
-
70
- this . _Ember . RSVP . on ( 'error' , reason => {
71
- if ( getCurrentHub ( ) . getIntegration ( Ember ) ) {
72
- getCurrentHub ( ) . withScope ( scope => {
73
- if ( isInstanceOf ( reason , Error ) ) {
74
- scope . setExtra ( 'context' , 'Unhandled Promise error detected' ) ;
75
- getCurrentHub ( ) . captureException ( reason , { originalException : reason } ) ;
76
- } else {
77
- scope . setExtra ( 'reason' , reason ) ;
78
- getCurrentHub ( ) . captureMessage ( 'Unhandled Promise error detected' ) ;
79
- }
80
- } ) ;
81
- }
82
- } ) ;
83
- }
84
- }
0 commit comments