Module: Metaractor::ChainFailures

Defined in:
lib/metaractor/chain_failures.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/metaractor/chain_failures.rb', line 3

def self.included(base)
  base.class_eval do
    around :chain_nested_failures
  end
end

Instance Method Details

#chain_nested_failures(interactor) ⇒ Object



9
10
11
12
13
14
# File 'lib/metaractor/chain_failures.rb', line 9

def chain_nested_failures(interactor)
  interactor.call
rescue Interactor::Failure => e
  context.fail_from_context(context: e.context)
  raise
end