Skip to content

Commit

Permalink
Changed that uncaught exceptions raised any where in the application …
Browse files Browse the repository at this point in the history
…will cause RAILS_ROOT/public/500.html to be read and shown instead of just the static "Application error (Rails)" [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4955 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Sep 3, 2006
1 parent 71dbef6 commit 3558322
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


* Changed that uncaught exceptions raised any where in the application will cause RAILS_ROOT/public/500.html to be read and shown instead of just the static "Application error (Rails)" [DHH]

* Integration tests: thoroughly test ActionController::Integration::Session. #6022 [Kevin Clark] * Integration tests: thoroughly test ActionController::Integration::Session. #6022 [Kevin Clark]
(tests skipped unless you `gem install mocha`) (tests skipped unless you `gem install mocha`)


Expand Down
11 changes: 7 additions & 4 deletions actionpack/lib/action_controller/rescue.rb
Expand Up @@ -48,9 +48,10 @@ def log_error(exception) #:doc:
# Overwrite to implement public exception handling (for requests answering false to <tt>local_request?</tt>). # Overwrite to implement public exception handling (for requests answering false to <tt>local_request?</tt>).
def rescue_action_in_public(exception) #:doc: def rescue_action_in_public(exception) #:doc:
case exception case exception
when RoutingError, UnknownAction then when RoutingError, UnknownAction
render_text(IO.read(File.join(RAILS_ROOT, 'public', '404.html')), "404 Not Found") render_text(IO.read(File.join(RAILS_ROOT, 'public', '404.html')), "404 Not Found")
else render_text "<html><body><h1>Application error (Rails)</h1></body></html>" else
render_text(IO.read(File.join(RAILS_ROOT, 'public', '500.html')), "500 Internal Error")
end end
end end


Expand Down Expand Up @@ -125,8 +126,10 @@ def template_path_for_local_rescue(exception)


def response_code_for_rescue(exception) def response_code_for_rescue(exception)
case exception case exception
when UnknownAction, RoutingError then "404 Page Not Found" when UnknownAction, RoutingError
else "500 Internal Error" "404 Page Not Found"
else
"500 Internal Error"
end end
end end


Expand Down

0 comments on commit 3558322

Please sign in to comment.