Skip to content

Commit 281f077

Browse files
committed
chore: demo
1 parent 0e55045 commit 281f077

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

demo-snippets/vue/install.ts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Vue from 'nativescript-vue';
22
import * as Sentry from '@nativescript-community/sentry';
33
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';
55
import { on as applicationOn, launchEvent } from '@nativescript/core/application';
66
import 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 {

demo-snippets/webpack.config.vue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ module.exports.onWebpackConfig = function (config, env, params) {
5757
cleanArtifacts: true
5858
},
5959
sourcemaps: {
60+
rewriteSources: (source, map) => source.replace('webpack:///', '~/'),
6061
ignore: ['tns-java-classes', 'hot-update'],
6162
assets: [dist + '/**/*.js', join(dist, process.env.SOURCEMAP_REL_DIR) + '/*.map']
6263
}

0 commit comments

Comments
 (0)