Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('captures an exception', async ({ page }) => {
type: 'ReferenceError',
value: 'NonExistentComponent is not defined',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand All @@ -39,7 +39,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'ReferenceError',
value: 'NonExistentComponent is not defined',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand All @@ -64,7 +64,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'ReferenceError',
value: 'NonExistentComponent is not defined',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('captures an exception', async ({ page }) => {
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -53,7 +53,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -82,7 +82,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('captures an exception', async ({ page }) => {
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -53,7 +53,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -81,7 +81,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('captures an exception', async ({ page }) => {
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -51,7 +51,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -79,7 +79,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('captures an exception', async ({ page }) => {
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -51,7 +51,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -79,7 +79,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('captures an exception', async ({ page }) => {
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -51,7 +51,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 1 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down Expand Up @@ -79,7 +79,7 @@ test('captures a second exception after resetting the boundary', async ({ page }
type: 'Error',
value: 'Error 2 thrown from Sentry ErrorBoundary in Solid Start E2E test app',
mechanism: {
type: 'generic',
type: 'auto.function.solid.error_boundary',
handled: true,
},
},
Expand Down
7 changes: 6 additions & 1 deletion packages/solid/src/errorboundary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export function withSentryErrorBoundary(ErrorBoundary: Component<ErrorBoundaryPr
const [local, others] = splitProps(props, ['fallback']);

const fallback = (error: unknown, reset: () => void): JSX.Element => {
captureException(error);
captureException(error, {
mechanism: {
handled: true, // handled because user has to provide a fallback
type: 'auto.function.solid.error_boundary',
},
});

const f = local.fallback;
return typeof f === 'function' ? f(error, reset) : f;
Expand Down
21 changes: 18 additions & 3 deletions packages/solid/test/errorboundary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders the fallback component', async () => {
Expand Down Expand Up @@ -89,13 +94,23 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});

const button = await findByRole('button');
await user.click(button);

expect(mockCaptureException).toHaveBeenCalledTimes(2);
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders children when there is no error', async () => {
Expand Down
21 changes: 18 additions & 3 deletions packages/solidstart/test/client/errorboundary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders the fallback component', async () => {
Expand Down Expand Up @@ -89,13 +94,23 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});

const button = await findByRole('button');
await user.click(button);

expect(mockCaptureException).toHaveBeenCalledTimes(2);
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders children when there is no error', async () => {
Expand Down
21 changes: 18 additions & 3 deletions packages/solidstart/test/server/errorboundary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenLastCalledWith(new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders the fallback component', async () => {
Expand Down Expand Up @@ -89,13 +94,23 @@ describe('withSentryErrorBoundary', () => {
));

expect(mockCaptureException).toHaveBeenCalledTimes(1);
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(1, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});

const button = await findByRole('button');
await user.click(button);

expect(mockCaptureException).toHaveBeenCalledTimes(2);
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'));
expect(mockCaptureException).toHaveBeenNthCalledWith(2, new ReferenceError('NonExistentComponent is not defined'), {
mechanism: {
handled: true,
type: 'auto.function.solid.error_boundary',
},
});
});

it('renders children when there is no error', async () => {
Expand Down