Skip to content

Commit 0af57a4

Browse files
authored
ref(browser): Only set event.stacktrace if we have 1 or more frames (getsentry#4614)
1 parent c60556f commit 0af57a4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/browser/src/eventbuilder.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ export function eventFromString(
143143
};
144144

145145
if (options.attachStacktrace && syntheticException) {
146-
event.stacktrace = {
147-
frames: parseStackFrames(syntheticException),
148-
};
146+
const frames = parseStackFrames(syntheticException);
147+
if (frames.length) {
148+
event.stacktrace = { frames };
149+
}
149150
}
150151

151152
return event;

packages/browser/src/parsers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ export function eventFromPlainObject(
5454
};
5555

5656
if (syntheticException) {
57-
event.stacktrace = {
58-
frames: parseStackFrames(syntheticException),
59-
};
57+
const frames = parseStackFrames(syntheticException);
58+
if (frames.length) {
59+
event.stacktrace = { frames };
60+
}
6061
}
6162

6263
return event;

0 commit comments

Comments
 (0)