Module: ActiveAgent::Rescue

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Rescuable
Included in:
Base
Defined in:
lib/active_agent/concerns/rescue.rb

Overview

Provides exception handling for action prompts using ‘rescue_from` declarations.

Handler methods must be public or protected because ActiveSupport::Rescuable uses ‘Kernel#method()` for lookup.

Instance Method Summary collapse

Instance Method Details

#handle_exceptions { ... } ⇒ Object

Yields to block with exception handling. Rescues using registered handlers or re-raises.

Yields:

  • block to execute with exception handling

Raises:

  • (Exception)

    if no handler is registered for the exception



34
35
36
37
38
# File 'lib/active_agent/concerns/rescue.rb', line 34

def handle_exceptions
  yield
rescue Exception => exception
  rescue_with_handler(exception) || raise
end