Skip to content

Commit

Permalink
fix: sentry integration fields
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Jan 22, 2025
1 parent 8d70a9b commit 800c1b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/extensions/sentry-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ export function createEventProcessor(

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

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

exception.stacktrace.frames.forEach((frame: any) => {
frame.platform = 'web:javascript'
})
}
})

Expand Down
17 changes: 10 additions & 7 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1952,13 +1952,16 @@ export class PostHog {
captureException(error: Error, additionalProperties?: Properties): void {
const syntheticException = new Error('PostHog syntheticException')
const properties: Properties = isFunction(assignableWindow.__PosthogExtensions__?.parseErrorAsProperties)
? assignableWindow.__PosthogExtensions__.parseErrorAsProperties(
[error.message, undefined, undefined, undefined, error],
// create synthetic error to get stack in cases where user input does not contain one
// creating the exceptionas soon into our code as possible means we should only have to
// remove a single frame (this 'captureException' method) from the resultant stack
{ syntheticException }
)
? {
...assignableWindow.__PosthogExtensions__.parseErrorAsProperties(
[error.message, undefined, undefined, undefined, error],
// create synthetic error to get stack in cases where user input does not contain one
// creating the exceptions soon into our code as possible means we should only have to
// remove a single frame (this 'captureException' method) from the resultant stack
{ syntheticException }
),
...additionalProperties,
}
: {
$exception_level: 'error',
$exception_list: [
Expand Down

0 comments on commit 800c1b6

Please sign in to comment.