Skip to content

Commit 566929b

Browse files
authored
ref(core): Adjust mechanism in captureConsoleIntegration (#17633)
Sets a more specific mechanism type, following the Trace Origin naming scheme. ref #17212
1 parent 28d183a commit 566929b

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- ref(astro): Adjust `mechanism` on error events captured by astro middleware ([#17613](https://github.com/getsentry/sentry-javascript/pull/17613))
1919
- ref(aws-severless): Slightly adjust aws-serverless mechanism type ([#17614](https://github.com/getsentry/sentry-javascript/pull/17614))
2020
- ref(bun): Adjust `mechanism` of errors captured in Bun.serve ([#17616](https://github.com/getsentry/sentry-javascript/pull/17616))
21+
- ref(core): Adjust `mechanism` in `captureConsoleIntegration` ([#17633](https://github.com/getsentry/sentry-javascript/pull/17633))
2122
- ref(core): Adjust MCP server error event `mechanism` ([#17622](https://github.com/getsentry/sentry-javascript/pull/17622))
2223
- ref(core): Simplify `linkedErrors` mechanism logic ([#17600](https://github.com/getsentry/sentry-javascript/pull/17600))
2324
- ref(nextjs): Set more specific event `mechanism`s ([#17543](https://github.com/getsentry/sentry-javascript/pull/17543))

dev-packages/browser-integration-tests/suites/integrations/captureConsole-attachStackTrace/test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sentryTest(
3737
expect(logEvent?.exception?.values![0]).toMatchObject({
3838
mechanism: {
3939
handled: true,
40-
type: 'console',
40+
type: 'auto.core.capture_console',
4141
synthetic: true,
4242
},
4343
value: 'console log',
@@ -59,7 +59,7 @@ sentryTest(
5959
expect(warnEvent?.exception?.values![0]).toMatchObject({
6060
mechanism: {
6161
handled: true,
62-
type: 'console',
62+
type: 'auto.core.capture_console',
6363
synthetic: true,
6464
},
6565
value: 'console warn',
@@ -81,7 +81,7 @@ sentryTest(
8181
expect(infoEvent?.exception?.values![0]).toMatchObject({
8282
mechanism: {
8383
handled: true,
84-
type: 'console',
84+
type: 'auto.core.capture_console',
8585
synthetic: true,
8686
},
8787
value: 'console info',
@@ -103,7 +103,7 @@ sentryTest(
103103
expect(errorEvent?.exception?.values![0]).toMatchObject({
104104
mechanism: {
105105
handled: true,
106-
type: 'console',
106+
type: 'auto.core.capture_console',
107107
synthetic: true,
108108
},
109109
value: 'console error',
@@ -125,7 +125,7 @@ sentryTest(
125125
expect(traceEvent?.exception?.values![0]).toMatchObject({
126126
mechanism: {
127127
handled: true,
128-
type: 'console',
128+
type: 'auto.core.capture_console',
129129
synthetic: true,
130130
},
131131
value: 'console trace',
@@ -153,7 +153,7 @@ sentryTest(
153153
expect(errorWithErrorEvent?.exception?.values?.[0].value).toBe('console error with error object');
154154
expect(errorWithErrorEvent?.exception?.values?.[0].mechanism).toEqual({
155155
handled: true,
156-
type: 'console',
156+
type: 'auto.core.capture_console',
157157
});
158158
expect(traceWithErrorEvent).toEqual(
159159
expect.objectContaining({

dev-packages/browser-integration-tests/suites/integrations/captureConsole/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ sentryTest('it captures console messages correctly', async ({ getLocalTestUrl, p
9696
expect(errorWithErrorEvent?.exception?.values?.[0].value).toBe('console error with error object');
9797
expect(errorWithErrorEvent?.exception?.values?.[0].mechanism).toEqual({
9898
handled: true,
99-
type: 'console',
99+
type: 'auto.core.capture_console',
100100
});
101101
expect(traceWithErrorEvent).toEqual(
102102
expect.objectContaining({

packages/core/src/integrations/captureconsole.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function consoleHandler(args: unknown[], level: string, handled: boolean): void
6565

6666
addExceptionMechanism(event, {
6767
handled,
68-
type: 'console',
68+
type: 'auto.core.capture_console',
6969
});
7070

7171
return event;

packages/core/test/lib/integrations/captureconsole.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ describe('CaptureConsole setup', () => {
328328

329329
expect(someEvent.exception?.values?.[0]?.mechanism).toEqual({
330330
handled: true,
331-
type: 'console',
331+
type: 'auto.core.capture_console',
332332
});
333333
});
334334

@@ -352,7 +352,7 @@ describe('CaptureConsole setup', () => {
352352

353353
expect(someEvent.exception?.values?.[0]?.mechanism).toEqual({
354354
handled: true,
355-
type: 'console',
355+
type: 'auto.core.capture_console',
356356
});
357357
});
358358

@@ -376,7 +376,7 @@ describe('CaptureConsole setup', () => {
376376

377377
expect(someEvent.exception?.values?.[0]?.mechanism).toEqual({
378378
handled: false,
379-
type: 'console',
379+
type: 'auto.core.capture_console',
380380
});
381381
});
382382
});

0 commit comments

Comments
 (0)