Class: Chanko::ExceptionHandler
- Inherits:
-
Object
- Object
- Chanko::ExceptionHandler
- Defined in:
- lib/chanko/exception_handler.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Class Method Summary collapse
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(exception, unit = nil) ⇒ ExceptionHandler
constructor
A new instance of ExceptionHandler.
Constructor Details
#initialize(exception, unit = nil) ⇒ ExceptionHandler
Returns a new instance of ExceptionHandler.
9 10 11 12 |
# File 'lib/chanko/exception_handler.rb', line 9 def initialize(exception, unit = nil) @exception = exception @unit = unit end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
7 8 9 |
# File 'lib/chanko/exception_handler.rb', line 7 def exception @exception end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
7 8 9 |
# File 'lib/chanko/exception_handler.rb', line 7 def unit @unit end |
Class Method Details
.handle(*args) ⇒ Object
3 4 5 |
# File 'lib/chanko/exception_handler.rb', line 3 def self.handle(*args) new(*args).handle end |
Instance Method Details
#handle ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/chanko/exception_handler.rb', line 14 def handle if propagated? raise exception else log raise exception if raised? end end |