getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.76k stars 1.52k forks source link

NestErrorHandler reports error wrongly #12745

Open GP4cK opened 4 days ago

GP4cK commented 4 days ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.13.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup/Reproduction Example

No response

Steps to Reproduce

The issue is with this line: https://github.com/getsentry/sentry-javascript/blob/13ff71f8adfbdfe3de0f9e50ff59f5ebbfa131f9/packages/node/src/integrations/tracing/nest.ts#L103

It tries to get the status of the exception by calling exception.status. However, if we follow the nestjs docs and throw exceptions, the status should be read with exception.getStatus().

Expected Result

Http errors where status is >=400 and <500 should not be reported to sentry

Actual Result

Http errors where status is >=400 and <500 are reported to sentry

nicohrubec commented 4 days ago

Hey, this feature was only recently introduced and was not yet part of the 8.13.0 SDK release. We just released 8.14.0, which now includes the filtering. So updating to 8.14.0 should fix your issue.