11import Vue from 'nativescript-vue' ;
22import * as Sentry from '@nativescript-community/sentry' ;
33import * 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' ;
55import { on as applicationOn , launchEvent } from '@nativescript/core/application' ;
66import Basic from './Basic' ;
77
@@ -19,23 +19,25 @@ async function startSentry() {
1919 dsn : SENTRY_DSN ,
2020 debug : true ,
2121 enablePerformanceV2 : true ,
22+ appPrefix : '~/' ,
2223 release : `${ __APP_ID__ } @${ __APP_VERSION__ } +${ __APP_BUILD_NUMBER__ } ` ,
2324 dist : `${ __APP_BUILD_NUMBER__ } .${ __ANDROID__ ? 'android' : 'ios' } ` ,
2425 flushSendEvent : true ,
2526 enableNativeCrashHandling : true ,
2627 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+ // ],
3941 enableUIViewControllerTracing : false ,
4042 enableUserInteractionTracing : false ,
4143 enableAutoBreadcrumbTracking : false
@@ -76,6 +78,18 @@ async function startSentry() {
7678 }
7779 } ) ;
7880 } ) ;
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 ) ;
7993 setTimeout ( ( ) => {
8094 Sentry . withScope ( ( scope ) => {
8195 try {
0 commit comments