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

feat(nestjs): Filter all HttpExceptions #13120

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

nicohrubec
Copy link
Contributor

So far we are filtering exceptions on the status code and do not report 4xx errors. However, we actually only want to capture unexpected exceptions but all HttpExceptions are only ever thrown explicitly. Hence, we do not want to capture them and they should be filtered.

In @sentry/nest we can use the nest HttpException directly, since we have @nest/common as a dependency. In @sentry/node this is not the case, so we filter based on whether a property called status is defined.

@nicohrubec nicohrubec self-assigned this Jul 30, 2024
@nicohrubec nicohrubec linked an issue Jul 30, 2024 that may be closed by this pull request
@nicohrubec nicohrubec marked this pull request as ready for review July 30, 2024 19:24
@nicohrubec nicohrubec requested review from lforst and chargome July 30, 2024 19:25
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

LGTM!

Not directly related to these changes but maybe we should check out if this setup works with graphql at some point (see: https://github.com/nestjs/graphql/blob/master/packages/graphql/lib/interfaces/gql-exception-filter.interface.ts)

@nicohrubec nicohrubec merged commit 7150e3f into develop Jul 31, 2024
112 checks passed
@nicohrubec nicohrubec deleted the nh/nest-ignore-http-exceptions branch July 31, 2024 08:39
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.

Filter all HttpExceptions in @sentry/nestjs
2 participants