Class: RescueRegistry::RailsExceptionHandler

Inherits:
ExceptionHandler show all
Defined in:
lib/rescue_registry/exception_handler.rb

Overview

Builds a payload in the style of the Rails default handling for compatibility

Instance Attribute Summary

Attributes inherited from ExceptionHandler

#exception, #status

Instance Method Summary collapse

Methods inherited from ExceptionHandler

default_status, #detail, #error_code, #formatted_response, #initialize, #meta, #title

Constructor Details

This class inherits a constructor from RescueRegistry::ExceptionHandler

Instance Method Details

#build_payload(show_details: false, traces: nil) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/rescue_registry/exception_handler.rb', line 146

def build_payload(show_details: false, traces: nil)
  body = {
    status: status_code,
    error:  title
  }

  if show_details
    body[:exception] = exception.inspect
    if traces
      body[:traces] = traces
    end
  end

  body
end