Sha256: 5f19c03e83242187d037753e6c55394dfab68736d51795840019fa95fa516cc4
Contents?: true
Size: 1.3 KB
Versions: 8
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module ConvenientService module Service module Plugins module CollectsServicesInException class Middleware < MethodChainMiddleware intended_for [ :initialize, :result, :fallback_result ], entity: :service ## # @raise [StandardError] # # @internal # NOTE: `rescue ::StandardError => exception` is the same as `rescue => exception`. # def next(...) chain.next(...) rescue => exception exception.instance_exec { define_singleton_method(:services) { @services ||= [] } } unless exception.respond_to?(:services) Utils::Array.limited_push(exception.services, service_details, limit: max_services_size) raise end private ## # @return [Hash{Symbol => Object}] # def service_details Commands::ExtractServiceDetails.call(service: entity, method: method) end ## # @return [Integer] # def max_services_size middleware_arguments.kwargs.fetch(:max_services_size) { Constants::DEFAULT_MAX_SERVICES_SIZE } end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems