Class: TwirpRails::ErrorHandling::Base::ExceptionHandler
- Inherits:
-
Struct
- Object
- Struct
- TwirpRails::ErrorHandling::Base::ExceptionHandler
- Defined in:
- lib/twirp_rails/error_handling/base.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
- #handle(exception, handler) ⇒ Object
- #match?(exception) ⇒ Boolean
- #process(exception, handler) ⇒ Object
Instance Attribute Details
#exception ⇒ Object
Returns the value of attribute exception
6 7 8 |
# File 'lib/twirp_rails/error_handling/base.rb', line 6 def exception @exception end |
#proc ⇒ Object
Returns the value of attribute proc
6 7 8 |
# File 'lib/twirp_rails/error_handling/base.rb', line 6 def proc @proc end |
Instance Method Details
#handle(exception, handler) ⇒ Object
11 12 13 |
# File 'lib/twirp_rails/error_handling/base.rb', line 11 def handle(exception, handler) proc.call(exception, handler) end |
#match?(exception) ⇒ Boolean
7 8 9 |
# File 'lib/twirp_rails/error_handling/base.rb', line 7 def match?(exception) exception.is_a?(self.exception) end |
#process(exception, handler) ⇒ Object
15 16 17 |
# File 'lib/twirp_rails/error_handling/base.rb', line 15 def process(exception, handler) match?(exception) ? handle(exception, handler) : nil end |