Module: Temescal::Response

Defined in:
lib/temescal/response.rb

Class Method Summary collapse

Class Method Details

.build(error) ⇒ Object

Public: Builds a response body for the Rack response.

error - The Temescal::Error object representing the caught exception.

Returns an Array containing a JSON string as the response body.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/temescal/response.rb', line 11

def self.build(error)
  [
    {
      $_temescal_configuration.meta_key => {
        status:  error.status,
        error:   error.type,
        message: error.message
      }
    }.to_json
  ]
end