Skip to content

Commit

Permalink
Merge pull request #341 from rollbar/fix-uncaught-options
Browse files Browse the repository at this point in the history
unify configuration options
  • Loading branch information
rokob authored Jul 21, 2017
2 parents 930d5af + 596e83d commit 605cc37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,17 +768,17 @@ constructor.
var Rollbar = require('rollbar');
var rollbar = new Rollbar({
accessToken: 'POST_SERVER_ITEM_ACCESS_TOKEN',
handleUncaughtExceptions: true,
handleUnhandledRejections: true
captureUncaught: true,
captureUnhandledRejections: true
});

// log a generic message and send to rollbar
rollbar.log('Hello world!');
```
Setting the ```handleUncaughtExceptions``` option to true will register Rollbar as a handler for
Setting the ```captureUncaught``` option to true will register Rollbar as a handler for
any uncaught exceptions in your Node process.

Similarly, setting the ```handleUnhandledRejections``` option to true will register Rollbar as a
Similarly, setting the ```captureUnhandledRejections``` option to true will register Rollbar as a
handler for any unhandled Promise rejections in your Node process.

<!-- RemoveNextIfProject -->
Expand Down Expand Up @@ -1066,8 +1066,8 @@ New:
```js
var rollbar = new Rollbar({
accessToken: "POST_SERVER_ITEM_ACCESS_TOKEN",
handleUncaughtExceptions: true,
handleUnhandledRejections: true
captureUncaught: true,
captureUnhandledRejections: true
});

```
Expand All @@ -1085,7 +1085,7 @@ const Rollbar = require('rollbar');

const rollbar = Rollbar.init({
accessToken: "POST_SERVER_ITEM_ACCESS_TOKEN",
handleUncaughtExceptions: true
captureUncaught: true
});
```

Expand Down
4 changes: 2 additions & 2 deletions src/browser/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function Rollbar(options, client) {
this.client = client || new Client(this.options, api, logger, 'browser');
addTransformsToNotifier(this.client.notifier);
addPredicatesToQueue(this.client.queue);
if (this.options.captureUncaught) {
if (this.options.captureUncaught || this.options.handleUncaughtExceptions) {
globals.captureUncaughtExceptions(window, this);
globals.wrapGlobals(window, this);
}
if (this.options.captureUnhandledRejections) {
if (this.options.captureUnhandledRejections || this.options.handleUnhandledRejections) {
globals.captureUnhandledRejections(window, this);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function Rollbar(options, client) {
addTransformsToNotifier(this.client.notifier);
addPredicatesToQueue(this.client.queue);

if (this.options.handleUncaughtExceptions) {
if (this.options.captureUncaught || this.options.handleUncaughtExceptions) {
this.handleUncaughtExceptions();
}
if (this.options.handleUnhandledRejections) {
if (this.options.captureUnhandledRejections || this.options.handleUnhandledRejections) {
this.handleUnhandledRejections();
}
}
Expand Down

0 comments on commit 605cc37

Please sign in to comment.