|
1 | 1 | import { VERSION } from '@angular/core';
|
2 | 2 | import type { BrowserOptions } from '@sentry/browser';
|
3 |
| -import { getDefaultIntegrations, init as browserInit, setContext } from '@sentry/browser'; |
4 |
| -import { applySdkMetadata } from '@sentry/core'; |
| 3 | +import { |
| 4 | + breadcrumbsIntegration, |
| 5 | + globalHandlersIntegration, |
| 6 | + httpContextIntegration, |
| 7 | + linkedErrorsIntegration, |
| 8 | +} from '@sentry/browser'; |
| 9 | +import { init as browserInit, setContext } from '@sentry/browser'; |
| 10 | +import { |
| 11 | + applySdkMetadata, |
| 12 | + dedupeIntegration, |
| 13 | + functionToStringIntegration, |
| 14 | + inboundFiltersIntegration, |
| 15 | +} from '@sentry/core'; |
| 16 | +import type { Integration } from '@sentry/types'; |
5 | 17 | import { logger } from '@sentry/utils';
|
6 | 18 |
|
7 | 19 | import { IS_DEBUG_BUILD } from './flags';
|
8 | 20 |
|
| 21 | +/** |
| 22 | + * Get the default integrations for the Angular SDK. |
| 23 | + */ |
| 24 | +export function getDefaultIntegrations(): Integration[] { |
| 25 | + // Don't include the BrowserApiErrors integration as it interferes with the Angular SDK's `ErrorHandler`: |
| 26 | + // BrowserApiErrors would catch certain errors before they reach the `ErrorHandler` and |
| 27 | + // thus provide a lower fidelity error than what `SentryErrorHandler` |
| 28 | + // (see errorhandler.ts) would provide. |
| 29 | + // |
| 30 | + // see: |
| 31 | + // - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097 |
| 32 | + // - https://github.com/getsentry/sentry-javascript/issues/2744 |
| 33 | + return [ |
| 34 | + inboundFiltersIntegration(), |
| 35 | + functionToStringIntegration(), |
| 36 | + breadcrumbsIntegration(), |
| 37 | + globalHandlersIntegration(), |
| 38 | + linkedErrorsIntegration(), |
| 39 | + dedupeIntegration(), |
| 40 | + httpContextIntegration(), |
| 41 | + ]; |
| 42 | +} |
| 43 | + |
9 | 44 | /**
|
10 | 45 | * Inits the Angular SDK
|
11 | 46 | */
|
12 | 47 | export function init(options: BrowserOptions): void {
|
13 | 48 | const opts = {
|
14 |
| - // Filter out BrowserApiErrors integration as it interferes with our Angular `ErrorHandler`: |
15 |
| - // BrowserApiErrors would catch certain errors before they reach the `ErrorHandler` and thus provide a |
16 |
| - // lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide. |
17 |
| - // see: |
18 |
| - // - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097 |
19 |
| - // - https://github.com/getsentry/sentry-javascript/issues/2744 |
20 |
| - defaultIntegrations: getDefaultIntegrations(options).filter(integration => { |
21 |
| - return integration.name !== 'BrowserApiErrors'; |
22 |
| - }), |
| 49 | + defaultIntegrations: getDefaultIntegrations(), |
23 | 50 | ...options,
|
24 | 51 | };
|
25 | 52 |
|
|
0 commit comments