Guest User

Untitled

a guest
Jun 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. module ActionDispatch
  2. class ShowExceptions
  3.  
  4. private
  5.  
  6. def original_exception(exception)
  7. if registered_original_exception?(exception)
  8. exception.original_exception
  9. else
  10. exception
  11. end
  12. end
  13.  
  14. def registered_original_exception?(exception)
  15. exception.respond_to?(:original_exception) && @@rescue_responses.has_key?(exception.original_exception.class.name)
  16. end
  17.  
  18. def rescue_action_locally_with_original_exception(request, exception)
  19. rescue_action_locally_without_original_exception(request, original_exception(exception))
  20. end
  21. alias_method_chain :rescue_action_locally, :original_exception
  22.  
  23. def rescue_action_in_public_with_original_exception(exception)
  24. rescue_action_in_public_without_original_exception(original_exception(exception))
  25. end
  26. alias_method_chain :rescue_action_in_public, :original_exception
  27. end
  28. end
Add Comment
Please, Sign In to add comment