mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 01:03:50 +02:00
add pinia action trail to sentry events
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
import { getSentry, isSentryOptedIn } from '../plugin';
|
||||
import { createPiniaActionTrailPlugin } from '../plugin/piniaActionTrail';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useAppearanceSettingsStore } from './settings/appearance';
|
||||
import { useAuthStore } from './auth';
|
||||
@@ -38,11 +39,17 @@ import { useWristOverlaySettingsStore } from './settings/wristOverlay';
|
||||
|
||||
export const pinia = createPinia();
|
||||
|
||||
function registerPiniaActionTrailPlugin() {
|
||||
if (!NIGHTLY) return;
|
||||
pinia.use(createPiniaActionTrailPlugin({ maxEntries: 200 }));
|
||||
}
|
||||
|
||||
async function registerSentryPiniaPlugin() {
|
||||
if (!NIGHTLY) return;
|
||||
if (!(await isSentryOptedIn())) return;
|
||||
|
||||
const Sentry = await getSentry();
|
||||
|
||||
pinia.use(
|
||||
Sentry.createSentryPiniaPlugin({
|
||||
stateTransformer: (state) => ({
|
||||
@@ -114,6 +121,7 @@ async function registerSentryPiniaPlugin() {
|
||||
}
|
||||
|
||||
export async function initPiniaPlugins() {
|
||||
registerPiniaActionTrailPlugin();
|
||||
await registerSentryPiniaPlugin();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { debounce, parseLocation } from '../shared/utils';
|
||||
import { AppDebug } from '../service/appConfig';
|
||||
import { database } from '../service/database';
|
||||
import { failedGetRequests } from '../service/request';
|
||||
import { getPiniaActionTrail } from '../plugin/piniaActionTrail';
|
||||
import { refreshCustomScript } from '../shared/utils/base/ui';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
import { useAvatarProviderStore } from './avatarProvider';
|
||||
@@ -527,12 +528,18 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
if (advancedSettingsStore.sentryErrorReporting) {
|
||||
try {
|
||||
import('@sentry/vue').then((Sentry) => {
|
||||
Sentry.captureMessage(
|
||||
`crash message: ${crashMessage}`,
|
||||
{
|
||||
level: 'fatal'
|
||||
}
|
||||
);
|
||||
const trail = getPiniaActionTrail();
|
||||
Sentry.withScope((scope) => {
|
||||
scope.setLevel('fatal');
|
||||
scope.setTag('reason', 'crash-recovery');
|
||||
scope.setContext('pinia_actions', {
|
||||
trail,
|
||||
count: trail.length
|
||||
});
|
||||
Sentry.captureMessage(
|
||||
`crash message: ${crashMessage}`
|
||||
);
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error setting up Sentry feedback:', error);
|
||||
|
||||
Reference in New Issue
Block a user