Exception: ConvenientService::Service::Plugins::HasJSendResultShortSyntax::Exceptions::KwargsContainJSendAndExtraKeys Private
- Inherits:
-
Exception
- Object
- StandardError
- Exception
- ConvenientService::Service::Plugins::HasJSendResultShortSyntax::Exceptions::KwargsContainJSendAndExtraKeys
- Defined in:
- lib/convenient_service/service/plugins/has_j_send_result_short_syntax/exceptions.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.
Instance Method Summary collapse
Methods inherited from Exception
Instance Method Details
#initialize_with_kwargs(status:) ⇒ void
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.
This method returns an undefined value.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/convenient_service/service/plugins/has_j_send_result_short_syntax/exceptions.rb', line 17 def initialize_with_kwargs(status:) = <<~TEXT `kwargs` passed to `#{status}` method contain JSend keys and extra keys. That's NOT allowed. Please, consider something like: # Shorter form. Assumes that all kwargs are `data`. #{status}(foo: :bar) # Shorter form with one arg. Assumes that arg is `message`. #{status}("foo") # Shorter form with two args. Assumes that first arg is `message` and second is `code`. #{status}("foo", :foo) # Longer form. More explicit `data`. #{status}(data: {foo: :bar}) # Longer form. More explicit `message`. #{status}(message: "foo") # Longer form. More explicit `code`. #{status}(code: :foo) # Longer form. More explicit `message` and `code` together. #{status}(message: "foo", code: :foo) # (Advanced) Longer form also supports any other variation of `data`, `message` and `code`. #{status}(data: {foo: :bar}, message: "foo") #{status}(data: {foo: :bar}, code: :foo) #{status}(data: {foo: :bar}, message: "foo", code: :foo) TEXT initialize() end |