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, #to_proc

Instance Method Details

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

Apply transformation to input

Parameters:

  • (Object)

Returns:



487
488
489
490
491
# File 'lib/morpher/transform.rb', line 487

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