Skip to content

Conversation

@mydea
Copy link
Member

@mydea mydea commented May 2, 2024

This was brought up here #5578 (comment),

our error handler implementation was too naive, and our tests not ideal - the tests only checked that stuff is sent to sentry (which it was!) but not that the page otherwise worked.

Now, I updated the test to ensure this works as expected.

With this PR, the signature for Sentry.setupNestErrorHandler() changes ( breaking change, but sadly required at this point). You have to pass in an exception filter, which we'll extend to also send exceptions to Sentry:

import { BaseExceptionFilter, HttpAdapterHost } from '@nestjs/core';

const { httpAdapter } = app1.get(HttpAdapterHost);
Sentry.setupNestErrorHandler(app1, new BaseExceptionFilter(httpAdapter));

This is a bit more involved, but also allows you to use a custom filter if needed (we can extend any exception filter).

@mydea mydea self-assigned this May 2, 2024
@mydea mydea requested review from lforst, onurtemizkan and s1gr1d May 2, 2024 13:44
@mydea mydea enabled auto-merge (squash) May 2, 2024 14:32
@mydea mydea merged commit dc7b1f5 into develop May 2, 2024
@mydea mydea deleted the fn/nestjs-fix branch May 2, 2024 14:36
Copy link
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants