|
1 |
| -import { Event, EventHint, EventProcessor, ExtendedError, Hub, Integration } from '@sentry/types'; |
2 |
| -import { isError, isPlainObject, logger, normalize } from '@sentry/utils'; |
| 1 | +import { Contexts, Event, EventHint, EventProcessor, ExtendedError, Hub, Integration } from '@sentry/types'; |
| 2 | +import { addNonEnumerableProperty, isError, isPlainObject, logger, normalize } from '@sentry/utils'; |
3 | 3 |
|
4 | 4 | import { IS_DEBUG_BUILD } from './flags';
|
5 | 5 |
|
@@ -53,23 +53,22 @@ export class ExtraErrorData implements Integration {
|
53 | 53 | if (!hint || !hint.originalException || !isError(hint.originalException)) {
|
54 | 54 | return event;
|
55 | 55 | }
|
56 |
| - const name = (hint.originalException as ExtendedError).name || hint.originalException.constructor.name; |
| 56 | + const exceptionName = (hint.originalException as ExtendedError).name || hint.originalException.constructor.name; |
57 | 57 |
|
58 | 58 | const errorData = this._extractErrorData(hint.originalException as ExtendedError);
|
59 | 59 |
|
60 | 60 | if (errorData) {
|
61 |
| - let contexts = { |
| 61 | + const contexts: Contexts = { |
62 | 62 | ...event.contexts,
|
63 | 63 | };
|
64 | 64 |
|
65 | 65 | const normalizedErrorData = normalize(errorData, this._options.depth);
|
| 66 | + |
66 | 67 | if (isPlainObject(normalizedErrorData)) {
|
67 |
| - contexts = { |
68 |
| - ...event.contexts, |
69 |
| - [name]: { |
70 |
| - ...normalizedErrorData, |
71 |
| - }, |
72 |
| - }; |
| 68 | + // We mark the error data as "already normalized" here, because we don't want other normalization procedures to |
| 69 | + // potentially truncate the data we just already normalized, with a certain depth setting. |
| 70 | + addNonEnumerableProperty(normalizedErrorData, '__sentry_skip_normalization__', true); |
| 71 | + contexts[exceptionName] = normalizedErrorData; |
73 | 72 | }
|
74 | 73 |
|
75 | 74 | return {
|
|
0 commit comments