Created
October 11, 2010 13:08
-
-
Save sandro/620478 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionDispatch | |
class ShowExceptions | |
private | |
def original_exception(exception) | |
if registered_original_exception?(exception) | |
exception.original_exception | |
else | |
exception | |
end | |
end | |
def registered_original_exception?(exception) | |
exception.respond_to?(:original_exception) && @@rescue_responses.has_key?(exception.original_exception.class.name) | |
end | |
def rescue_action_locally_with_original_exception(request, exception) | |
rescue_action_locally_without_original_exception(request, original_exception(exception)) | |
end | |
alias_method_chain :rescue_action_locally, :original_exception | |
def rescue_action_in_public_with_original_exception(exception) | |
rescue_action_in_public_without_original_exception(original_exception(exception)) | |
end | |
alias_method_chain :rescue_action_in_public, :original_exception | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment