Skip to content

Commit

Permalink
don't send any handled error
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Jun 22, 2023
1 parent fa1a80e commit cc4b0ce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AppComponent {
if (remoteVer.compare(curVer) > 0) {
await this.notifyUpdate(info, remoteVer);
}
});
}).catch(noop);
deviceManager.load();
}

Expand Down
8 changes: 3 additions & 5 deletions src/app/core/services/backend-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export abstract class BackendClient {
tauri.invoke(cmd, args)
.then(result => {
console.debug('invoke', `${this.category}/${method}`, 'result', result);
return result;
this.zone.run(() => resolve(result as any));
})
.catch(reason => {
console.warn('invoke', `${this.category}/${method}`, 'error', reason);
throw new BackendError(reason);
})
.then(result => this.zone.run(() => resolve(result as any)))
.catch(reason => this.zone.run(() => reject(reason)));
this.zone.run(() => reject(new BackendError(reason)));
});
});
}

Expand Down
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {AppConfig} from './environments/environment';
import ReleaseInfo from './release.json';
import * as Sentry from "@sentry/angular-ivy";
import {Breadcrumb, defaultStackParser} from "@sentry/angular-ivy";
import {remove} from "lodash";

Sentry.init({
dsn: "https://93c623f5a47940f0b7bac7d0d5f6a91f@o4504977150377984.ingest.sentry.io/4504978685689856",
Expand All @@ -15,7 +16,7 @@ Sentry.init({
routingInstrumentation: Sentry.routingInstrumentation,
})
],
enabled: !!ReleaseInfo.version,
enabled: true,
environment: AppConfig.environment,
release: ReleaseInfo.version || 'local',
stackParser: (stack: string, skipFirst?: number) => {
Expand All @@ -26,6 +27,15 @@ Sentry.init({
beforeBreadcrumb: (breadcrumb: Breadcrumb) => {
return breadcrumb.level !== 'debug' ? breadcrumb : null;
},
beforeSend: (event) => {
if (event.exception?.values) {
const filtered = remove(event.exception?.values, e => e.mechanism?.handled !== true);
if (filtered.length === 0) {
return null;
}
}
return event;
},
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
Expand Down

0 comments on commit cc4b0ce

Please sign in to comment.