Skip to content

Commit 5ae054c

Browse files
authored
ref(core): Add more specific exception mechanism for internal errors (#17253)
see #17212 part of #17252
1 parent aab4276 commit 5ae054c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/core/src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,10 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
11601160
}
11611161

11621162
this.captureException(reason, {
1163+
mechanism: {
1164+
handled: false,
1165+
type: 'internal',
1166+
},
11631167
data: {
11641168
__sentry__: true,
11651169
},

packages/core/test/lib/client.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,12 +1848,17 @@ describe('Client', () => {
18481848

18491849
client.captureEvent({ message: 'hello' }, {}, scope);
18501850

1851-
expect(TestClient.instance!.event!.exception!.values![0]).toStrictEqual({ type: 'Error', value: 'sorry' });
1851+
expect(TestClient.instance!.event!.exception!.values![0]).toStrictEqual({
1852+
type: 'Error',
1853+
value: 'sorry',
1854+
mechanism: { type: 'internal', handled: false },
1855+
});
18521856
expect(captureExceptionSpy).toBeCalledWith(exception, {
18531857
data: {
18541858
__sentry__: true,
18551859
},
18561860
originalException: exception,
1861+
mechanism: { type: 'internal', handled: false },
18571862
});
18581863
expect(loggerWarnSpy).toBeCalledWith(
18591864
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${exception}`,

0 commit comments

Comments
 (0)