Class: Graphiti::Rails::ExceptionHandler
- Inherits:
-
RescueRegistry::ExceptionHandler
- Object
- RescueRegistry::ExceptionHandler
- Graphiti::Rails::ExceptionHandler
- Defined in:
- lib/graphiti/rails/exception_handlers.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#build_payload(show_details: false, traces: nil, style: :rails) ⇒ Object
We’ve actually changed the signature here which is somewhat risky…
- #formatted_response(content_type, **options) ⇒ Object
Instance Method Details
#build_payload(show_details: false, traces: nil, style: :rails) ⇒ Object
We’ve actually changed the signature here which is somewhat risky…
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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., 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) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/graphiti/rails/exception_handlers.rb', line 38 def formatted_response(content_type, **) # 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) [:style] = :standard end super end |