Skip to content

Commit 08e22c9

Browse files
committed
fix(node): Use normalizeDepth option when creating events from unknown input
1 parent 70883aa commit 08e22c9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/node/src/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export class NodeClient extends BaseClient<NodeClientOptions> {
118118
*/
119119
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
120120
public eventFromException(exception: any, hint?: EventHint): PromiseLike<Event> {
121-
return resolvedSyncPromise(eventFromUnknownInput(this._options.stackParser, exception, hint));
121+
return resolvedSyncPromise(
122+
eventFromUnknownInput(this._options.stackParser, exception, hint, this._options.normalizeDepth),
123+
);
122124
}
123125

124126
/**

packages/node/src/eventbuilder.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ export function exceptionFromError(stackParser: StackParser, error: Error): Exce
4646
* Builds and Event from a Exception
4747
* @hidden
4848
*/
49-
export function eventFromUnknownInput(stackParser: StackParser, exception: unknown, hint?: EventHint): Event {
49+
export function eventFromUnknownInput(
50+
stackParser: StackParser,
51+
exception: unknown,
52+
hint?: EventHint,
53+
normalizeDepth?: number,
54+
): Event {
5055
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5156
let ex: unknown = exception;
5257
const providedMechanism: Mechanism | undefined =
@@ -63,7 +68,7 @@ export function eventFromUnknownInput(stackParser: StackParser, exception: unkno
6368
const message = `Non-Error exception captured with keys: ${extractExceptionKeysForMessage(exception)}`;
6469

6570
getCurrentHub().configureScope(scope => {
66-
scope.setExtra('__serialized__', normalizeToSize(exception));
71+
scope.setExtra('__serialized__', normalizeToSize(exception, normalizeDepth));
6772
});
6873

6974
ex = (hint && hint.syntheticException) || new Error(message);

0 commit comments

Comments
 (0)