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

Cannot capture breadcrumbs without installing, cannot install without creating uncaughtException handler

Open turpault-autodesk opened this issue 8 years ago • 3 comments

When multiple instances of the Raven client are created through the Raven.Client() call, each single instance must be install()ed before the captureException/captureMessage calls.

However, install()ing the newly created client also installs the uncaughtException handler, which is not always the desired behaviour.

Installing the uncaughtException handler shall either be optional when install()ing the client, or install() should be made optional when captureMessage/Exception are called.

turpault-autodesk avatar Apr 25 '17 14:04 turpault-autodesk

I'm not able to reproduce this as you're describing. The following file:

var Raven = require('raven');

var sentryDsn = '<sentry dsn>';
var r1 = new Raven.Client(sentryDsn);
var r2 = new Raven.Client(sentryDsn);

r1.captureException(new Error('did this capture r1?'));
r2.captureException(new Error('did this capture r2?'));

produces two events in Sentry for me. Can you provide more details on what you're observing?

The only two relevant things that should change when .install is called are:

  • the global process.on('uncaughtException') handler is added (should probably add an opt-out
  • captureBreadcrumb will start to actually record breadcrumbs (I don't immediately recall why it's still like this, might be able to have breadcrumbs recorded without install)

I'm interested in a potential repro of captureException/captureMessage not working without .install() since I can't repro that myself, but either way at the very least there's an action item here of "make it possible to capture breadcrumbs without installing a global exception handler".

LewisJEllis avatar Apr 25 '17 17:04 LewisJEllis

My mistake, it was actually the breadcrumb that was not sent during the captureXX() call.

Do you want me to close this bug and open a new one ?

Again, sorry for the noise.

turpault-autodesk avatar Apr 25 '17 18:04 turpault-autodesk

No worries, we can just repurpose this issue. Thanks for bringing this to my attention.

LewisJEllis avatar Apr 26 '17 18:04 LewisJEllis