Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add type to Sentry exception #1520

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress/e2e/error-tracking.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('Exception capture', () => {
cy.phCaptures({ full: true }).then((captures) => {
expect(captures.map((c) => c.event)).to.deep.equal(['$pageview', '$autocapture', '$exception'])
expect(captures[2].event).to.be.eql('$exception')
expect(captures[2].properties.$exception_list[0].stacktrace.type).to.be.eq('raw')
expect(captures[2].properties.$exception_list[0].stacktrace.frames.length).to.be.eq(1)
expect(captures[2].properties.$exception_list[0].stacktrace.frames[0].function).to.be.eq(
'HTMLButtonElement.onclick'
Expand Down
9 changes: 8 additions & 1 deletion src/extensions/sentry-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { SeverityLevel } from '../types'
// Uncomment the above and comment the below to get type checking for development

type _SentryEvent = any
type _SentryException = any
type _SentryEventProcessor = any
type _SentryHub = any

Expand Down Expand Up @@ -90,7 +91,13 @@ export function createEventProcessor(
event.tags['PostHog Recording URL'] = _posthog.get_session_replay_url({ withTimestamp: true })
}

const exceptions = event.exception?.values || []
const exceptions: _SentryException[] = event.exception?.values || []

exceptions.map((exception) => {
if (exception.stacktrace) {
exception.stacktrace.type = 'raw'
}
})

const data: SentryExceptionProperties & {
// two properties added to match any exception auto-capture
Expand Down
Loading