diff --git a/packages/core/src/integrations/index.ts b/packages/core/src/integrations/index.ts index faf37671e3e6..1c470dd87604 100644 --- a/packages/core/src/integrations/index.ts +++ b/packages/core/src/integrations/index.ts @@ -1,4 +1,3 @@ export { Dedupe } from './dedupe'; export { FunctionToString } from './functiontostring'; export { InboundFilters } from './inboundfilters'; -export { ExtraErrorData } from './extraerrordata'; diff --git a/packages/core/src/integrations/extraerrordata.ts b/packages/integrations/src/extraerrordata.ts similarity index 91% rename from packages/core/src/integrations/extraerrordata.ts rename to packages/integrations/src/extraerrordata.ts index bad2f877cf78..7bd00bcf4b34 100644 --- a/packages/core/src/integrations/extraerrordata.ts +++ b/packages/integrations/src/extraerrordata.ts @@ -4,6 +4,11 @@ import { isError, isPlainObject } from '@sentry/utils/is'; import { logger } from '@sentry/utils/logger'; import { normalize } from '@sentry/utils/object'; +/** JSDoc */ +interface ExtraErrorDataOptions { + depth?: number; +} + /** Patch toString calls to return proper name for wrapped functions */ export class ExtraErrorData implements Integration { /** @@ -16,6 +21,11 @@ export class ExtraErrorData implements Integration { */ public static id: string = 'ExtraErrorData'; + /** + * @inheritDoc + */ + public constructor(private readonly options: ExtraErrorDataOptions = { depth: 3 }) {} + /** * @inheritDoc */ @@ -44,7 +54,7 @@ export class ExtraErrorData implements Integration { ...event.extra, }; - const normalizedErrorData = normalize(errorData); + const normalizedErrorData = normalize(errorData, this.options.depth); if (isPlainObject(normalizedErrorData)) { extra = { ...event.extra, diff --git a/packages/core/test/lib/integrations/extraerrordata.test.ts b/packages/integrations/test/extraerrordata.test.ts similarity index 96% rename from packages/core/test/lib/integrations/extraerrordata.test.ts rename to packages/integrations/test/extraerrordata.test.ts index 1d1057932404..78531732d7be 100644 --- a/packages/core/test/lib/integrations/extraerrordata.test.ts +++ b/packages/integrations/test/extraerrordata.test.ts @@ -1,5 +1,5 @@ import { ExtendedError, SentryEvent } from '@sentry/types'; -import { ExtraErrorData } from '../../../src/integrations/extraerrordata'; +import { ExtraErrorData } from '../src/extraerrordata'; const extraErrorData = new ExtraErrorData(); let event: SentryEvent;