Skip to content

Commit

Permalink
ref: Some random code fixes by biome (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
BYK authored Aug 12, 2024
1 parent e5b84d2 commit 1b5cd67
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/electron/src/electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ async function askForPermissionToSendToSentry(event: Sentry.Event, hint?: Sentry
showErrorMessage();
if (store.get('sentry-enabled') === false) {
return null;
} else if (store.get('sentry-enabled') === true) {
if (hint && hint.attachments && hint.attachments.length > 0) {
}
if (store.get('sentry-enabled') === true) {
if (hint?.attachments && hint.attachments.length > 0) {
return askToSendEnvelope(event, hint);
}
return event;
Expand All @@ -295,19 +296,20 @@ async function askForPermissionToSendToSentry(event: Sentry.Event, hint?: Sentry
if (response === 1) {
store.set('sentry-enabled', false);
return null;
} else {
store.set('sentry-enabled', true);
if (hint && hint.attachments && hint.attachments.length > 0) {
return askToSendEnvelope(event, hint);
}
return event;
}

store.set('sentry-enabled', true);
if (hint?.attachments && hint.attachments.length > 0) {
return askToSendEnvelope(event, hint);
}
return event;
}

async function askToSendEnvelope(event: Sentry.Event, hint?: Sentry.EventHint) {
if (store.get('sentry-send-envelopes') === false) {
return null;
} else if (store.get('sentry-send-envelopes') === true) {
}
if (store.get('sentry-send-envelopes') === true) {
return event;
}

Expand All @@ -316,22 +318,22 @@ async function askToSendEnvelope(event: Sentry.Event, hint?: Sentry.EventHint) {
buttons: ['Yes', 'No'],
title: 'Spotlight',
message: 'Can we also send the payload Spotlight received so we can fully reproduce the error?',
detail: 'Again, just makes things eaiser for us. (Can be changed in the settings menu)',
detail: 'Again, just makes things easier for us. (Can be changed in the settings menu)',
});

if (response === 1) {
Sentry.configureScope(scope => {
scope.clearAttachments();
});
if (hint && hint.attachments && hint.attachments.length > 0) {
if (hint?.attachments && hint.attachments.length > 0) {
hint.attachments = [];
}
store.set('sentry-send-envelopes', false);
return event;
} else {
store.set('sentry-send-envelopes', true);
return event;
}

store.set('sentry-send-envelopes', true);
return event;
}

function storeIncomingPayload(body: string) {
Expand Down

0 comments on commit 1b5cd67

Please sign in to comment.