Class: PicoApi::Entities::Errors

Inherits:
ROM::Struct
  • Object
show all
Defined in:
lib/pico_api/entities/errors.rb

Class Method Summary collapse

Class Method Details

.call(error) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/pico_api/entities/errors.rb', line 7

def call(error)
  class_name = error.class.name.demodulize
  error_entities = [
    Entities::Error.new(
      title: class_name.underscore,
      detail: error.message
    )
  ]
  new(errors: error_entities)
end