Module: Lotus::Action::Throwable::ClassMethods
- Defined in:
- lib/lotus/action/throwable.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
-
#handle_exception(exception, status) ⇒ Object
protected
Handle the given exception with an HTTP status code.
Class Method Details
.extended(base) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lotus/action/throwable.rb', line 21 def self.extended(base) base.class_eval do include Utils::ClassAttribute # Action handled exceptions. # # When an handled exception is raised during #call execution, it will be # translated into the associated HTTP status. # # By default there aren't handled exceptions, all the errors are threaded # as a Server Side Error (500). # # @api private # @since 0.1.0 # # @see Lotus::Controller.handled_exceptions # @see Lotus::Action::Throwable.handle_exception class_attribute :handled_exceptions self.handled_exceptions = Controller.handled_exceptions.dup end end |
Instance Method Details
#handle_exception(exception, status) ⇒ Object (protected)
Handle the given exception with an HTTP status code.
When the exception is raise during #call execution, it will be translated into the associated HTTP status.
This is a fine grained control, for a global configuration see Lotus::Action.handled_exceptions
74 75 76 |
# File 'lib/lotus/action/throwable.rb', line 74 def handle_exception(exception, status) self.handled_exceptions[exception] = status end |