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

Installing Raven without a DSN causes it to swallow uncaught exceptions #301

Closed
idris opened this issue Mar 29, 2017 · 7 comments
Closed

Comments

@idris
Copy link

idris commented Mar 29, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Installing Raven without a DSN causes it to swallow uncaught exceptions. We do this in our dev environment. Here is some sample code that will show the failure:

var Raven = require('raven');
var dsn = undefined;
Raven.config(dsn);
Raven.install(function (sentToSentry, err) {
  console.error('Uncaught Error:', err.message);
  process.exit(1);
});

throw new Error('oops');

Result:

$ node test.js
raven@1.2.0 alert: no DSN provided, error reporting disabled
raven@1.2.0 alert: uncaughtException: e2dd6808a0634382a2608a66c6a7641d

Note it does not call my callback (which logs, then exits), and it does not exit the process.
(In this example, the process actually exits, but only because there's nothing else to do. In the real world if you're running an express server or something, the process will not exit).

What is the expected behavior?

It should call the provided callback with sentToSentry=false, thus allowing me to log the error and call process.exit(1);

@idris
Copy link
Author

idris commented Mar 29, 2017

As a workaround, for now, I'm doing:

var Raven = require('raven');
var dsn = undefined;
Raven.config(dsn);
if (dsn) {
  Raven.install(function (sentToSentry, err) {
    console.error('Uncaught Error:', err.message);
    process.exit(1);
  });
}

throw new Error('oops');

@francisdb
Copy link

Similar to #288 which points to #257

@LewisJEllis
Copy link
Contributor

This behavior is fixed after #308. Refer to this comment for a rundown of the new behavior.

Please let me know if you have any other scenarios or use cases that the new behavior doesn't accommodate.

@francisdb
Copy link

Can we get a release with this fix?

@LewisJEllis
Copy link
Contributor

@francisdb will publish tomorrow as per #314

@LewisJEllis
Copy link
Contributor

@francisdb 2.0.0 has been published

@francisdb
Copy link

Thanks!

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

3 participants