Class: ConvenientService::Service::Plugins::CollectsServicesInException::Middleware Private

Inherits:
MethodChainMiddleware
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/collects_services_in_exception/middleware.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#nextObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (StandardError)

Since:

  • 1.0.0



29
30
31
32
33
34
35
36
37
# File 'lib/convenient_service/service/plugins/collects_services_in_exception/middleware.rb', line 29

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