Skip to content

Conversation

@matux
Copy link
Contributor

@matux matux commented Nov 10, 2025

Description of the change

Ensure Notifier.log passes null as the second argument when Rollbar is disabled to be consistent with contract.

Also: Normalize callback to a noop when it’s not a function and simplify the callback assignment.

Type of change

  • Maintenance

@matux matux requested a review from Copilot November 10, 2025 20:14
@matux matux self-assigned this Nov 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Notifier.log method by ensuring consistent callback behavior and simplifying the callback normalization logic. The key change addresses an inconsistency where the disabled Rollbar case was not passing null as the second argument to the callback, unlike other error paths in the same method.

Key changes:

  • Simplified callback normalization using a ternary operator and arrow function
  • Added null as second argument when Rollbar is disabled to match the error handling pattern used elsewhere in the method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


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.

@matux matux enabled auto-merge (squash) November 10, 2025 20:21
@matux matux merged commit c35c4f6 into master Nov 10, 2025
6 checks passed
@matux matux deleted the matux/notifier-null branch November 10, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants