Module: Granite::Action::ExceptionsHandling::ClassMethods

Defined in:
lib/granite/action/exceptions_handling.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#handle_exception(klass, &block) ⇒ Hash<Class, Proc>

Register default handler for exceptions thrown inside execute_perform! and after_commit methods.

Parameters:

  • klass

    Exception class, could be parent class too [Class]

  • block (Block<Exception>)

    with default behavior for handling specified type exceptions. First block argument is raised exception instance.

Returns:

  • (Hash<Class, Proc>)

    Registered handlers



20
21
22
# File 'lib/granite/action/exceptions_handling.rb', line 20

def handle_exception(klass, &block)
  self._exception_handlers = _exception_handlers.merge(klass => block)
end