Class: Morpher::Transform::Exception

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

Overview

Generic exception transformer

Instance Method Summary collapse

Methods inherited from Morpher::Transform

#slug

Instance Method Details

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

Apply transformation to input

Parameters:

  • (Object)

Returns:



449
450
451
452
453
# File 'lib/morpher/transform.rb', line 449

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