Skip to content

Commit

Permalink
ref: Move extraErrorData from @sentry/core to @sentry/integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Feb 26, 2019
1 parent 051ce83 commit 37b453e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/core/src/integrations/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { Dedupe } from './dedupe';
export { FunctionToString } from './functiontostring';
export { InboundFilters } from './inboundfilters';
export { ExtraErrorData } from './extraerrordata';
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand All @@ -16,6 +21,11 @@ export class ExtraErrorData implements Integration {
*/
public static id: string = 'ExtraErrorData';

/**
* @inheritDoc
*/
public constructor(private readonly options: ExtraErrorDataOptions = { depth: 3 }) {}

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 37b453e

Please sign in to comment.