diff --git a/static/app/bootstrap/index.tsx b/static/app/bootstrap/index.tsx index ee24bbe65956..54a5571f8af4 100644 --- a/static/app/bootstrap/index.tsx +++ b/static/app/bootstrap/index.tsx @@ -67,11 +67,9 @@ async function promiseRequest(url: string) { }; return [json, response.statusText, responseMeta]; } - // eslint-disable-next-line @typescript-eslint/only-throw-error - throw [response.status, response.statusText]; - } catch (error: any) { - // eslint-disable-next-line @typescript-eslint/only-throw-error - throw [error.status, error.statusText]; + return null; + } catch { + return null; } } diff --git a/static/app/bootstrap/initializeSdk.spec.tsx b/static/app/bootstrap/initializeSdk.spec.tsx index 66db0c6a6979..db837c8f434d 100644 --- a/static/app/bootstrap/initializeSdk.spec.tsx +++ b/static/app/bootstrap/initializeSdk.spec.tsx @@ -44,40 +44,6 @@ describe('initializeSdk', () => { }) ); }); - - it('filters malformed [null,null] unhandled rejections', () => { - initializeSdk({ - ...window.__initialData, - apmSampling: 1, - sentryConfig: { - allowUrls: [], - dsn: '', - release: '', - tracePropagationTargets: [], - }, - }); - - const initConfig = jest.mocked(Sentry.init).mock.calls.slice(-1)[0]?.[0]; - expect(initConfig?.beforeSend).toBeDefined(); - - const event = { - // The SDK has not normalized this to the stored `[null,null]` string yet. - message: [null, null] as unknown as string, - exception: { - values: [ - { - type: 'Error', - value: ',', - mechanism: { - type: 'auto.browser.global_handlers.onunhandledrejection', - }, - }, - ], - }, - } as Sentry.ErrorEvent; - - expect(initConfig?.beforeSend?.(event, {originalException: [null, null]})).toBeNull(); - }); }); describe('isFilteredRequestErrorEvent', () => { diff --git a/static/app/bootstrap/initializeSdk.tsx b/static/app/bootstrap/initializeSdk.tsx index 65f56097ae83..8931d9ed656b 100644 --- a/static/app/bootstrap/initializeSdk.tsx +++ b/static/app/bootstrap/initializeSdk.tsx @@ -185,11 +185,7 @@ export function initializeSdk(config: Config) { }, beforeSend(event, hint) { - if ( - isFilteredRequestErrorEvent(event) || - isEventWithFileUrl(event) || - isNullTupleUnhandledRejectionEvent(hint) - ) { + if (isFilteredRequestErrorEvent(event) || isEventWithFileUrl(event)) { return null; } @@ -279,21 +275,6 @@ export function isEventWithFileUrl(event: Event): boolean { return !!event.request?.url?.startsWith('file://'); } -/** - * Ignore unhandled rejections of `[null, null]`. The SDK keeps the original - * array in the hint until after `beforeSend`, then normalizes it to the - * `[null,null]` message shown in the stored event. - */ -function isNullTupleUnhandledRejectionEvent(hint: Sentry.EventHint): boolean { - const originalException = hint.originalException; - - return ( - Array.isArray(originalException) && - originalException.length === 2 && - originalException.every(value => value === null) - ); -} - /** Tag and set fingerprint for UndefinedResponseBodyError events */ function handlePossibleUndefinedResponseBodyErrors(event: Event): void { // One or both of these may be undefined, depending on the type of event diff --git a/static/app/types/system.tsx b/static/app/types/system.tsx index 38435511cda0..926942d89bb1 100644 --- a/static/app/types/system.tsx +++ b/static/app/types/system.tsx @@ -93,11 +93,11 @@ declare global { */ __sentry_preload?: { orgSlug?: string; - organization?: Promise; + organization?: Promise; organization_fallback?: Promise; - projects?: Promise; + projects?: Promise; projects_fallback?: Promise; - teams?: Promise; + teams?: Promise; teams_fallback?: Promise; }; /**