Skip to content

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 chargome and lforst 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
@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