Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,20 @@ export default class Notifier {
* backend in case of success.
*/
log(item, callback) {
let cb = callback;
if (!cb || !isFunction(cb)) {
cb = function () {};
}
callback = isFunction(callback) ? callback : () => {};

if (!this.options.enabled) {
return cb(new Error('Rollbar is not enabled'));
return callback(new Error('Rollbar is not enabled'), null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a big deal since it would be passing undefined, but docstring clearly states a null should be expected.

}

this.queue.addPendingItem(item);
const originalError = item.err;
this._applyTransforms(item, (err, i) => {
if (err) {
this.queue.removePendingItem(item);
return cb(err, null);
return callback(err, null);
}
this.queue.addItem(i, cb, originalError, item);
this.queue.addItem(i, callback, originalError, item);
});
}

Expand Down