Module: Axn::Core::Flow::Handlers::Invoker

Extended by:
Invoker
Included in:
Invoker
Defined in:
lib/axn/core/flow/handlers/invoker.rb

Overview

Shared block evaluation with consistent arity handling and error piping.

allow_flow_control: when true, done!/fail! (EarlyCompletion/Failure) propagate

out of the handler — use for execution-phase blocks (preprocess, defaults, etc.)
where the user legitimately controls action flow. When false (default), they are
piped as errors — use for post-execution contexts (callbacks, messages, matchers)
where the result is already finalized.

Instance Method Summary collapse

Instance Method Details

#call(action:, handler:, exception: nil, operation: "executing handler", allow_flow_control: false) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/axn/core/flow/handlers/invoker.rb', line 18

def call(action:, handler:, exception: nil, operation: "executing handler", allow_flow_control: false)
  return call_symbol_handler(action:, symbol: handler, exception:) if symbol?(handler)
  return call_callable_handler(action:, callable: handler, exception:) if callable?(handler)

  literal_value(handler)
rescue Axn::Internal::EarlyCompletion, Axn::Failure
  raise if allow_flow_control

  Axn::Internal::PipingError.swallow(operation, action:, exception: $ERROR_INFO)
rescue StandardError => e
  Axn::Internal::PipingError.swallow(operation, action:, exception: e)
end