Sha256: ddc7fe2f17b9161ed1e0d4833862d77c8ccee6b4e9c902e8978535c4c6cc8909
Contents?: true
Size: 594 Bytes
Versions: 1
Compression:
Stored size: 594 Bytes
Contents
module Dry class Transaction class StepAdapters # @api private class Try include Dry::Monads::Either::Mixin def call(step, input, *args) unless step.options[:catch] raise ArgumentError, "+try+ steps require one or more exception classes provided via +catch:+" end Right(step.operation.call(input, *args)) rescue *Array(step.options[:catch]) => e e = step.options[:raise].new(e.message) if step.options[:raise] Left(e) end end register :try, Try.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-transaction-0.9.0 | lib/dry/transaction/step_adapters/try.rb |