Class: Pelita::Operation::AttemptAdapter
- Inherits:
-
Dry::Transaction::StepAdapters
- Object
- Dry::Transaction::StepAdapters
- Pelita::Operation::AttemptAdapter
- Includes:
- Dry::Monads::Either::Mixin
- Defined in:
- lib/pelita/operation/attempt_adapter.rb
Instance Method Summary collapse
Instance Method Details
#call(step, input, *args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pelita/operation/attempt_adapter.rb', line 6 def call(step, input, *args) unless step.[:catch] raise ArgumentError, "+attempt+ steps require one or more exception classes provided via +catch:+" end step.operation.call(input, *args) rescue *Array(step.[:catch]) => e e = step.[:raise].new(e.) if step.[:raise] input["error"] = e Left(input) end |