Class: Morpher::Transform::Exception

Inherits:
Morpher::Transform show all
Defined in:
lib/morpher/transform.rb

Overview

Generic exception transform

Instance Method Summary collapse

Methods inherited from Morpher::Transform

#array, #maybe, #seq, #slug

Instance Method Details

#call(input) ⇒ Either<Error, Object>

Apply transformation to input

Parameters:

  • (Object)

Returns:



481
482
483
484
485
# File 'lib/morpher/transform.rb', line 481

def call(input)
  Either
    .wrap_error(error_class) { block.call(input) }
    .lmap { |exception| error(input: input, message: exception.to_s) }
end