Exception: MonadOxide::EitherReturnExpectedError

Inherits:
MonadOxideError
  • Object
show all
Defined in:
lib/either.rb

Overview

This ‘Exception’ is produced when a method that expects the function or block to provide a ‘Result’ but was given something else. Generally this Exception is not raised, but instead converts the Result into a an Err. Example methods with this behavior are Result#and_then and Result#or_else.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ EitherReturnExpectedError

The transformation expected a ‘Result’ but got something else.

Parameters:

  • data (Object)

    Whatever we got that wasn’t a ‘Result’.



38
39
40
41
# File 'lib/either.rb', line 38

def initialize(data)
  super("An Either was expected but got #{data.inspect()}.")
  data = @data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



42
43
44
# File 'lib/either.rb', line 42

def data
  @data
end