Skip to content

Commit c35c4f6

Browse files
authored
Simplify log and fix inconsistency with callback argument (#1427)
1 parent 5081120 commit c35c4f6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/notifier.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,20 @@ export default class Notifier {
6868
* backend in case of success.
6969
*/
7070
log(item, callback) {
71-
let cb = callback;
72-
if (!cb || !isFunction(cb)) {
73-
cb = function () {};
74-
}
71+
callback = isFunction(callback) ? callback : () => {};
7572

7673
if (!this.options.enabled) {
77-
return cb(new Error('Rollbar is not enabled'));
74+
return callback(new Error('Rollbar is not enabled'), null);
7875
}
7976

8077
this.queue.addPendingItem(item);
8178
const originalError = item.err;
8279
this._applyTransforms(item, (err, i) => {
8380
if (err) {
8481
this.queue.removePendingItem(item);
85-
return cb(err, null);
82+
return callback(err, null);
8683
}
87-
this.queue.addItem(i, cb, originalError, item);
84+
this.queue.addItem(i, callback, originalError, item);
8885
});
8986
}
9087

0 commit comments

Comments
 (0)