You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. require 'action_dispatch/middleware/exception_wrapper'
  2. require 'action_dispatch/routing/inspector'
  3. require 'action_view'
  4. module ActionDispatch
  5. # THIS IS A HACK TO unwrap TagWrapError when detected!
  6. # TagWrapError contains a 'tag' for SemanticLogger and the cause itself
  7. class DebugExceptions
  8. private
  9. def render_exception(request, exception, wrapper)
  10. ## PVINCENT's ADDITION for TagWrapError
  11. log_error(request, wrapper)
  12. if exception.is_a?(Semantic::TagWrapError)
  13. backtrace_cleaner = request.get_header('action_dispatch.backtrace_cleaner')
  14. wrapper = ExceptionWrapper.new(backtrace_cleaner, exception.error)
  15. end
  16. ## HERE it was commented off
  17. # log_error(request, wrapper)
  18. ## END OF ADDITION
  19. raise exception unless request.get_header('action_dispatch.show_detailed_exceptions')
  20. begin
  21. content_type = request.formats.first
  22. rescue ActionDispatch::Http::MimeNegotiation::InvalidType
  23. content_type = Mime[:text]
  24. end
  25. if api_request?(content_type)
  26. render_for_api_request(content_type, wrapper)
  27. else
  28. render_for_browser_request(request, wrapper)
  29. end
  30. end
  31. end
  32. end