Exception: ConvenientService::Service::Plugins::RaisesOnDoubleResult::Exceptions::DoubleResult

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

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(service:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/convenient_service/service/plugins/raises_on_double_result/exceptions.rb', line 9

def initialize_with_kwargs(service:)
  message = "    `\#{service.class}` service has a double result.\n\n    Make sure its #result calls only one from the following methods `success`, `failure`, or `error` and only once.\n\n    Maybe you missed `return`? The most common scenario is similar to this one:\n\n    def result\n      # ...\n\n      error unless valid?\n      # instead of return error unless valid?\n\n      success\n    end\n  TEXT\n\n  initialize(message)\nend\n"