Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

How can I log uncaught exceptions to the console while also using raven-node? #293

Closed
ClaasM opened this issue Mar 10, 2017 · 1 comment
Closed

Comments

@ClaasM
Copy link

ClaasM commented Mar 10, 2017

Consider the following snippet:

var Raven = require('raven'); Raven.config('https://abc@sentry.io/123').install(); throw new Error();

The thrown error is not printed to console.error; instead, raven@1.1.2 alert: uncaughtException: abc123 is logged.

During development, I (obviously) still need to see uncaught Exceptions for debugging.

I assume I misunderstood something, can someone point me in the right direction?
Thanks!

@LewisJEllis
Copy link
Contributor

LewisJEllis commented Mar 13, 2017

Along the lines of #288, this is a current shortcoming being addressed as part of work for #257. I didn't initially give enough consideration to what ideal behavior would be in the "development before production" use case.

For a workaround for now, you could listen to the logged event:

Raven.on('logged', function (err) {
  console.log('raven reported an error:');
  console.error(err);
});

or use the (currently undocumented) install callback argument:

Raven.config(...).install(function (sent, err) {
  console.log('error caught by raven:');
  console.error(err);
});

These do roughly the same thing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants