Sha256: fba1de561b93411a4b6ce36d1d3cd9f975c998ca3239990834444b417b333206

Contents?: true

Size: 704 Bytes

Versions: 4

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module RaisesOnNotResultReturnValue
        class Middleware < MethodChainMiddleware
          include Support::DependencyContainer::Import

          import :"commands.is_result?", from: Service::Plugins::HasJSendResult::Container

          intended_for any_method, entity: :service

          def next(...)
            original_result = chain.next(...)

            return original_result if commands.is_result?(original_result)

            raise Exceptions::ReturnValueNotKindOfResult.new(service: entity, result: original_result, method: method)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.16.0 lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.15.0 lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.14.0 lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb
convenient_service-0.13.0 lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb