Exception: Micro::Case::Error::InvalidResult
- Inherits:
-
TypeError
- Object
- TypeError
- Micro::Case::Error::InvalidResult
- Defined in:
- lib/micro/case/error.rb
Instance Method Summary collapse
-
#initialize(is_success, type, use_case) ⇒ InvalidResult
constructor
A new instance of InvalidResult.
Constructor Details
#initialize(is_success, type, use_case) ⇒ InvalidResult
Returns a new instance of InvalidResult.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/micro/case/error.rb', line 23 def initialize(is_success, type, use_case) base = "The result returned from #{use_case.class.name}#call! must be a Hash." result = is_success ? 'Success'.freeze : 'Failure'.freeze example = if type === :ok || type === :error || type === :exception "#{result}(result: { key: 'value' })" else "#{result}(:#{type}, result: { key: 'value' })" end super("#{base}\n\nExample:\n #{example}") end |