Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airbrake-ruby,notifier: use the Null Object pattern for notifiers #191

Merged
merged 1 commit into from
Apr 21, 2017

Conversation

kyrylo
Copy link
Contributor

@kyrylo kyrylo commented Apr 13, 2017

Fixes airbrake/airbrake#713
(undefined method `build_notice' for nil:NilClass)

It becomes really tedious to keep track of whether a notifier is
configured or not. Since we introduced Airbrake.[] to retrieve
notifiers, all integrations have to add an additional check for it:

if notifier = Airbrake[:default]
  notifier.notify(...)
end

With the current change this check is not needed anymore.

@kyrylo kyrylo force-pushed the airbrake-713-nil-notifier branch 2 times, most recently from 366aced to d8b2920 Compare April 13, 2017 16:24
@kyrylo kyrylo changed the title airbrake-ruby,notifier: use the Null Pattern for notifiers airbrake-ruby,notifier: use the Null Object Pattern for notifiers Apr 14, 2017
Fixes airbrake/airbrake#713
(undefined method `build_notice' for nil:NilClass)

It becomes really tedious to keep track of whether a notifier is
configured or not. Since we introduced `Airbrake.[]` to retrieve
notifiers, all integrations have to add an additional check for it:

```rb
if notifier = Airbrake[:default]
  notifier.notify(...)
end
```

With the current change this check is not needed anymore.
@kyrylo kyrylo changed the title airbrake-ruby,notifier: use the Null Object Pattern for notifiers airbrake-ruby,notifier: use the Null Object pattern for notifiers Apr 14, 2017
@kyrylo kyrylo force-pushed the airbrake-713-nil-notifier branch from d8b2920 to a627629 Compare April 14, 2017 09:20
@kyrylo kyrylo merged commit 15b43ea into master Apr 21, 2017
@kyrylo kyrylo deleted the airbrake-713-nil-notifier branch April 21, 2017 21:45
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.

2 participants