nest-raven icon indicating copy to clipboard operation
nest-raven copied to clipboard

How to log errors/message manually

Open nizamani opened this issue 3 years ago • 3 comments

In sentry JS package we were able to use Sentry.captureException or Sentry.captureMessage to capture any exceptions or messages outside of fatal errors. In your package only example I see here is capturing an Exception: https://github.com/mentos1386/nest-raven/tree/master/example/src

Most of the time we want to use try/catch to handle exceptions and then log those handled exceptions for example:

try {
// some exception raised here
} catch(e) {
     Sentry.captureException(e);
}

Is it possible to do the same with nest-raven package or your package just capture fatal errors and exceptions and we will need to use core sentry package to capture exceptions and messages?

nizamani avatar Sep 28 '21 18:09 nizamani

I am curious about this too. We're switching from https://www.npmjs.com/package/@ntegral/nestjs-sentry (as it seem unmaintained / buggy).

However, that package has a really nice way to inject the sentry module into services

simplenotezy avatar Sep 05 '22 19:09 simplenotezy

Basically this one feature is what's holding me back from using it

simplenotezy avatar Sep 05 '22 19:09 simplenotezy

Hmm - I ended up just doing this:

import * as Sentry from '@sentry/node';
Sentry.captureMessage('Less than 3 profiles returned from relevantDatingProfiles', 'warning');

And it seems to work just fine! 😊

simplenotezy avatar Sep 05 '22 20:09 simplenotezy

thanks for this note @simplenotezy! We were also looking at nestjs-sentry and seems a bit too inflexible for us. We need ot be able to use tracing and such as well.

tevonsb avatar Dec 03 '22 04:12 tevonsb

Hey all. What @simplenotezy recommends is an acceptable and expected solution for use with this library. This library is not trying to support all the features from sentry, but just the graphql/rest integration with NestJS.

For other features, the plain @sentry/node should be used, as it would be pointless for us to re-write or wrap all the functionality it provides.

I'm closing this as not planned.

mentos1386 avatar Feb 23 '24 08:02 mentos1386