Skip to content

Commit 2aa12ad

Browse files
committed
Added ability to handle errors that have no stack
1 parent 80ef6c4 commit 2aa12ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/browser/src/plugins/BrowserErrorPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export class BrowserErrorPlugin implements IEventPlugin {
7878
return frames;
7979
}
8080

81-
const result: StackFrame[] = await fromError(exception);
81+
const result: StackFrame[] = exception.stack ? await fromError(exception) : [];
8282
if (!result) {
83-
throw new Error("Unable to parse the exception stack trace.");
83+
throw new Error("Unable to parse the exception stack trace");
8484
}
8585

8686
// TODO: Test with reference error.

packages/node/src/plugins/NodeErrorPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export class NodeErrorPlugin implements IEventPlugin {
7272
return frames;
7373
}
7474

75-
const result = fromError(exception);
75+
const result = exception.stack ? fromError(exception) : [];
7676
if (!result) {
77-
throw new Error("Unable to parse the exception stack trace.");
77+
throw new Error("Unable to parse the exception stack trace");
7878
}
7979

8080
return Promise.resolve({

0 commit comments

Comments
 (0)