Sha256: 88a02a5a8d6209e2ee8e02299c45bae2d86befa9ad86e589107c77bfbeefd01b
Contents?: true
Size: 588 Bytes
Versions: 6
Compression:
Stored size: 588 Bytes
Contents
require "dry/transaction/errors" module Dry module Transaction class StepAdapters # @api private class Try include Dry::Monads::Result::Mixin def call(operation, options, args) unless options[:catch] raise MissingCatchListError.new(options[:step_name]) end result = operation.(*args) Success(result) rescue *Array(options[:catch]) => e e = options[:raise].new(e.message) if options[:raise] Failure(e) end end register :try, Try.new end end end
Version data entries
6 entries across 6 versions & 1 rubygems