Exception: ConvenientService::Service::Plugins::ForbidsConvenientServiceEntitiesAsConstructorArguments::Exceptions::ResultPassedAsConstructorArgument

Inherits:
Exception
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(selector:, service:, result:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb', line 23

def initialize_with_kwargs(selector:, service:, result:)
  message = <<~TEXT
    Result of `#{Utils::Class.display_name(result.service.class)}` is passed as constructor argument `#{selector}` to `#{Utils::Class.display_name(service.class)}`.

    It is an antipattern. It neglects the idea of steps.

    Please, try to reorganize `#{Utils::Class.display_name(service.class)}` service.
  TEXT

  initialize(message)
end