Exception: Solid::Result::Error::InvalidResultSource

Inherits:
Solid::Result::Error show all
Defined in:
lib/solid/result/error.rb

Class Method Summary collapse

Class Method Details

.build(given_result:, expected_source:) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/solid/result/error.rb', line 26

def self.build(given_result:, expected_source:)
  message =
    "You cannot call #and_then and return a result that does not belong to the same source!\n" \
    "Expected source: #{expected_source.inspect}\n" \
    "Given source: #{given_result.send(:source).inspect}\n" \
    "Given result: #{given_result.inspect}"

  new(message)
end