Class: Brainguy::ErrorCollectingNotifier
- Inherits:
-
ErrorHandlingNotifier
- Object
- BasicNotifier
- ErrorHandlingNotifier
- Brainguy::ErrorCollectingNotifier
- Defined in:
- lib/brainguy/error_collecting_notifier.rb
Overview
A notifier wrapper that captures exceptions and collects them into a Hash.
Constant Summary
Constants inherited from ErrorHandlingNotifier
Brainguy::ErrorHandlingNotifier::RAISE_STRATEGY, Brainguy::ErrorHandlingNotifier::SUPPRESS_STRATEGY, Brainguy::ErrorHandlingNotifier::WARN_STRATEGY
Instance Method Summary collapse
-
#add_error(subscription, error) ⇒ Object
private
Add another error to the list.
-
#initialize(notifier) ⇒ ErrorCollectingNotifier
constructor
A new instance of ErrorCollectingNotifier.
-
#result ⇒ Hash{Subscription => Exception}
Return list of errors captured while notifying subscriptions.
Methods inherited from ErrorHandlingNotifier
Methods inherited from BasicNotifier
Constructor Details
#initialize(notifier) ⇒ ErrorCollectingNotifier
Returns a new instance of ErrorCollectingNotifier.
7 8 9 10 |
# File 'lib/brainguy/error_collecting_notifier.rb', line 7 def initialize(notifier) super(notifier, method(:add_error)) @errors = {} end |
Instance Method Details
#add_error(subscription, error) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add another error to the list
14 15 16 |
# File 'lib/brainguy/error_collecting_notifier.rb', line 14 def add_error(subscription, error) @errors[subscription] = error end |
#result ⇒ Hash{Subscription => Exception}
Return list of errors captured while notifying subscriptions. One entry for every subscription that raised an error.
22 23 24 |
# File 'lib/brainguy/error_collecting_notifier.rb', line 22 def result @errors end |