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

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

Instance Method Summary collapse

Instance Method Details

#nextObject

Raises:

  • (StandardError)


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