1
1
import Vue from 'nativescript-vue' ;
2
2
import * as Sentry from '@nativescript-community/sentry' ;
3
3
import * as Tracing from '@nativescript-community/sentry/tracing' ;
4
- import { Application , NavigatedData , Page , Trace , Utils , View } from '@nativescript/core' ;
4
+ import { Application , NavigatedData , Page , Trace , TraceErrorHandler , Utils , View } from '@nativescript/core' ;
5
5
import { on as applicationOn , launchEvent } from '@nativescript/core/application' ;
6
6
import Basic from './Basic' ;
7
7
@@ -19,23 +19,25 @@ async function startSentry() {
19
19
dsn : SENTRY_DSN ,
20
20
debug : true ,
21
21
enablePerformanceV2 : true ,
22
+ appPrefix : '~/' ,
22
23
release : `${ __APP_ID__ } @${ __APP_VERSION__ } +${ __APP_BUILD_NUMBER__ } ` ,
23
24
dist : `${ __APP_BUILD_NUMBER__ } .${ __ANDROID__ ? 'android' : 'ios' } ` ,
24
25
flushSendEvent : true ,
25
26
enableNativeCrashHandling : true ,
26
27
attachScreenshot : true ,
27
- tracesSampleRate : 1.0 ,
28
- sampleRate : 1.0 ,
29
- enableAutoPerformanceTracking : true ,
30
- enableAutoSessionTracking : true ,
31
- integrations : [
32
- new Tracing . NativescriptTracing ( {
33
- enableAppStartTracking : true ,
34
- enableNativeFramesTracking : true ,
35
- // routingInstrumentation: HttpService.sentryTracing,
36
- enableStallTracking : true
37
- } )
38
- ] ,
28
+ // tracesSampleRate: 1.0,
29
+ // sampleRate: 1.0,
30
+ enableCrashHandler : false , // iOS
31
+ // enableAutoPerformanceTracking: true,
32
+ // enableAutoSessionTracking: true,
33
+ // integrations: [
34
+ // new Tracing.NativescriptTracing({
35
+ // enableAppStartTracking: true,
36
+ // enableNativeFramesTracking: true,
37
+ // // routingInstrumentation: HttpService.sentryTracing,
38
+ // enableStallTracking: true
39
+ // })
40
+ // ],
39
41
enableUIViewControllerTracing : false ,
40
42
enableUserInteractionTracing : false ,
41
43
enableAutoBreadcrumbTracking : false
@@ -76,6 +78,18 @@ async function startSentry() {
76
78
}
77
79
} ) ;
78
80
} ) ;
81
+ const errorHandler : TraceErrorHandler = {
82
+ handlerError ( err ) {
83
+ Sentry . captureException ( err ) ;
84
+ }
85
+ } ;
86
+ Application . on ( Application . uncaughtErrorEvent , ( event ) => {
87
+ Sentry . captureException ( event . error ) ;
88
+ } ) ;
89
+ Application . on ( Application . discardedErrorEvent , ( event ) => {
90
+ Sentry . captureException ( event . error ) ;
91
+ } ) ;
92
+ Trace . setErrorHandler ( errorHandler ) ;
79
93
setTimeout ( ( ) => {
80
94
Sentry . withScope ( ( scope ) => {
81
95
try {
0 commit comments