diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/subject.js b/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/subject.js new file mode 100644 index 000000000000..556cd5babb09 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/subject.js @@ -0,0 +1 @@ +Sentry.captureException(new Response('test body')); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/test.ts new file mode 100644 index 000000000000..4f93b7b87d44 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/builtInClassInstance/test.ts @@ -0,0 +1,20 @@ +import { expect } from '@playwright/test'; +import type { Event } from '@sentry/core'; +import { sentryTest } from '../../../../utils/fixtures'; +import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; + +sentryTest('should capture a class instance of a built-in class', async ({ getLocalTestUrl, page }) => { + const url = await getLocalTestUrl({ testDir: __dirname }); + + const eventData = await getFirstSentryEnvelopeRequest(page, url); + + expect(eventData.exception?.values).toHaveLength(1); + expect(eventData.exception?.values?.[0]).toMatchObject({ + type: 'Error', + value: '[object Response]', + mechanism: { + type: 'generic', + handled: true, + }, + }); +}); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts index 5cdd446a1510..19349532282e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts @@ -3,7 +3,7 @@ import type { Event } from '@sentry/core'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an POJO', async ({ getLocalTestUrl, page }) => { +sentryTest('should capture an class instance', async ({ getLocalTestUrl, page }) => { const url = await getLocalTestUrl({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url);