Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(www): always send the build number as a tag to Sentry #1747

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/www/app/cordova_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import * as Sentry from '@sentry/browser';

import {AbstractClipboard} from './clipboard';
import {EnvironmentVariables} from './environment';
import {SentryErrorReporter} from '../shared/error_reporter';
import {SentryErrorReporter, Tags} from '../shared/error_reporter';
import {main} from './main';
import * as errors from '../model/errors';
import {OutlinePlatform} from './platform';
Expand Down Expand Up @@ -70,8 +70,8 @@ async function pluginExecWithErrorCode<T>(cmd: string, ...args: unknown[]): Prom

// Adds reports from the (native) Cordova plugin.
class CordovaErrorReporter extends SentryErrorReporter {
constructor(appVersion: string, appBuildNumber: string, dsn: string) {
super(appVersion, dsn, {'build.number': appBuildNumber});
constructor(appVersion: string, dsn: string, tags: Tags) {
super(appVersion, dsn, tags);
// Initializes the error reporting framework with the supplied credentials.
// TODO(fortuna): This is an Promise that is not waited for and can cause a race condition.
// We should fix it with an async factory function for the Reporter.
Expand Down Expand Up @@ -144,9 +144,10 @@ class CordovaPlatform implements OutlinePlatform {
}

getErrorReporter(env: EnvironmentVariables) {
const sharedTags = {'build.number': env.APP_BUILD_NUMBER};
return this.hasDeviceSupport()
? new CordovaErrorReporter(env.APP_VERSION, env.APP_BUILD_NUMBER, env.SENTRY_DSN || '')
: new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {});
? new CordovaErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', sharedTags)
: new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', sharedTags);
}

getUpdater() {
Expand Down
Loading