diff --git a/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts index 2aa569915eb4..c8d7b3123482 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-connect/tests/errors.test.ts @@ -11,7 +11,13 @@ test('Sends correct error event', async ({ baseURL }) => { const errorEvent = await errorEventPromise; expect(errorEvent.exception?.values).toHaveLength(1); - expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception'); + const exception = errorEvent.exception?.values?.[0]; + expect(exception?.value).toBe('This is an exception'); + + expect(exception?.mechanism).toEqual({ + type: 'auto.middleware.connect', + handled: false, + }); expect(errorEvent.request).toEqual({ method: 'GET', diff --git a/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts index cadf29fbda90..dd0dfa4a084d 100644 --- a/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-koa/tests/errors.test.ts @@ -11,7 +11,13 @@ test('Sends correct error event', async ({ baseURL }) => { const errorEvent = await errorEventPromise; expect(errorEvent.exception?.values).toHaveLength(1); - expect(errorEvent.exception?.values?.[0]?.value).toBe('This is an exception with id 123'); + const exception = errorEvent.exception?.values?.[0]; + + expect(exception?.value).toBe('This is an exception with id 123'); + expect(exception?.mechanism).toEqual({ + type: 'auto.middleware.koa', + handled: false, + }); expect(errorEvent.request).toEqual({ method: 'GET', diff --git a/packages/node/src/integrations/tracing/connect.ts b/packages/node/src/integrations/tracing/connect.ts index c2ab3716bd33..3fd7d10b28fb 100644 --- a/packages/node/src/integrations/tracing/connect.ts +++ b/packages/node/src/integrations/tracing/connect.ts @@ -48,7 +48,12 @@ export const connectIntegration = defineIntegration(_connectIntegration); // eslint-disable-next-line @typescript-eslint/no-explicit-any function connectErrorMiddleware(err: any, req: any, res: any, next: any): void { - captureException(err); + captureException(err, { + mechanism: { + handled: false, + type: 'auto.middleware.connect', + }, + }); next(err); } diff --git a/packages/node/src/integrations/tracing/koa.ts b/packages/node/src/integrations/tracing/koa.ts index 487f471a9a12..7125479e91e0 100644 --- a/packages/node/src/integrations/tracing/koa.ts +++ b/packages/node/src/integrations/tracing/koa.ts @@ -134,7 +134,12 @@ export const setupKoaErrorHandler = (app: { use: (arg0: (ctx: any, next: any) => try { await next(); } catch (error) { - captureException(error); + captureException(error, { + mechanism: { + handled: false, + type: 'auto.middleware.koa', + }, + }); throw error; } });