Browse Source

comment

main
pvincent 1 month ago
parent
commit
714afcabd2
  1. 1
      app/controllers/scores_controller.rb
  2. 9
      lib/monkey_patches/action_dispatch/middleware/debug_exceptions.rb

1
app/controllers/scores_controller.rb

@ -37,7 +37,6 @@ class ScoresController < ApplicationController
end end
def destroy def destroy
raise 'azazazaza'
# @score.destroy! # @score.destroy!
# redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other # redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other

9
lib/monkey_patches/action_dispatch/middleware/debug_exceptions.rb

@ -1,24 +1,22 @@
require 'action_dispatch/middleware/exception_wrapper' require 'action_dispatch/middleware/exception_wrapper'
require 'action_dispatch/routing/inspector' require 'action_dispatch/routing/inspector'
require 'action_view' require 'action_view'
module ActionDispatch module ActionDispatch
# patched class to prevent deprecated message
# THIS IS A HACK TO unwrap TagWrapError when detected!
# TagWrapError contains a 'tag' for SemanticLogger and the cause itself
class DebugExceptions class DebugExceptions
private private
def render_exception(request, exception, wrapper) def render_exception(request, exception, wrapper)
## PVINCENT's ADDITION for TagWrapError ## PVINCENT's ADDITION for TagWrapError
log_error(request, wrapper) log_error(request, wrapper)
if exception.is_a?(Semantic::TagWrapError) if exception.is_a?(Semantic::TagWrapError)
backtrace_cleaner = request.get_header('action_dispatch.backtrace_cleaner') backtrace_cleaner = request.get_header('action_dispatch.backtrace_cleaner')
wrapper = ExceptionWrapper.new(backtrace_cleaner, exception.error) wrapper = ExceptionWrapper.new(backtrace_cleaner, exception.error)
end end
## HERE it was commented off
# log_error(request, wrapper) # log_error(request, wrapper)
## END OF ADDITION ## END OF ADDITION
raise exception unless request.get_header('action_dispatch.show_detailed_exceptions') raise exception unless request.get_header('action_dispatch.show_detailed_exceptions')
@ -28,7 +26,6 @@ module ActionDispatch
rescue ActionDispatch::Http::MimeNegotiation::InvalidType rescue ActionDispatch::Http::MimeNegotiation::InvalidType
content_type = Mime[:text] content_type = Mime[:text]
end end
if api_request?(content_type) if api_request?(content_type)
render_for_api_request(content_type, wrapper) render_for_api_request(content_type, wrapper)
else else

Loading…
Cancel
Save