class Graphiti::Rails::ExceptionHandler
Public Instance Methods
build_payload(show_details: false, traces: nil, style: :rails)
click to toggle source
We've actually changed the signature here which is somewhat risky…
Calls superclass method
# File lib/graphiti/rails/exception_handlers.rb, line 5 def build_payload(show_details: false, traces: nil, style: :rails) case style when :standard super(show_details: show_details, traces: traces).tap do |payload| if show_details # For Vandal and Request Responses payload[:__raw_error__] = { message: exception.message, debug: exception.instance_variable_get(:@__graphiti_debug), backtrace: exception.backtrace } end end when :rails # TODO: Find way to not duplicate RailsExceptionHandler body = { status: status_code, error: title } if show_details body[:exception] = exception.inspect if traces body[:traces] = traces end end body else raise ArgumentError, "unknown style #{style}" end end
formatted_response(content_type, **options)
click to toggle source
Calls superclass method
# File lib/graphiti/rails/exception_handlers.rb, line 38 def formatted_response(content_type, **options) # We're relying on the fact that `formatted_response` passes through unknown options to `build_payload` if Graphiti::Rails.handled_exception_formats.include?(content_type.to_sym) options[:style] = :standard end super end