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 |
#run ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/metaractor/chain_failures.rb', line 16 def run(...) run!(...) rescue Interactor::Failure # Intentionally rescue all Failures as we're # handling child errors by failing the parents # instead of allowing the child to raise # all of the way up. # Needed since Interactor v3.2.0. end |