aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/rescue.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-09-03 23:51:34 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-09-03 23:51:34 +0000
commit3558322b9d4af0775fb5c9922a588eaa7cd0c5a2 (patch)
tree4181d4598d5b680dd4df830aabb4726027de43ed /actionpack/lib/action_controller/rescue.rb
parent71dbef6d27210259ae263b84120f94fe9d6784e7 (diff)
downloadrails-3558322b9d4af0775fb5c9922a588eaa7cd0c5a2.tar.gz
rails-3558322b9d4af0775fb5c9922a588eaa7cd0c5a2.tar.bz2
rails-3558322b9d4af0775fb5c9922a588eaa7cd0c5a2.zip
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]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4955 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/rescue.rb')
-rw-r--r--actionpack/lib/action_controller/rescue.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index dd670fe96d..f9b831f18b 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -48,9 +48,10 @@ module ActionController #:nodoc:
# Overwrite to implement public exception handling (for requests answering false to <tt>local_request?</tt>).
def rescue_action_in_public(exception) #:doc:
case exception
- when RoutingError, UnknownAction then
+ when RoutingError, UnknownAction
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
@@ -125,8 +126,10 @@ module ActionController #:nodoc:
def response_code_for_rescue(exception)
case exception
- when UnknownAction, RoutingError then "404 Page Not Found"
- else "500 Internal Error"
+ when UnknownAction, RoutingError
+ "404 Page Not Found"
+ else
+ "500 Internal Error"
end
end