aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-06 18:25:01 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-06 18:25:01 +0000
commit0ffb6c16258b5c39a7417f4563edf0fc7542c9ae (patch)
tree2242cb28635f99410268f48d0415e97b4c5a5de1 /railties
parented14042feac6ff84670958fc3e2017aaacac5856 (diff)
downloadrails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.tar.gz
rails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.tar.bz2
rails-0ffb6c16258b5c39a7417f4563edf0fc7542c9ae.zip
Syntax errors and other exceptions thrown outside of an action are now gracefully handled by the dispatcher
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@51 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/dispatches/start_server1
-rw-r--r--railties/lib/dispatcher.rb12
-rw-r--r--railties/lib/generator.rb2
-rw-r--r--railties/lib/webrick_server.rb1
4 files changed, 4 insertions, 12 deletions
diff --git a/railties/dispatches/start_server b/railties/dispatches/start_server
deleted file mode 100644
index c6ecb4e4fe..0000000000
--- a/railties/dispatches/start_server
+++ /dev/null
@@ -1 +0,0 @@
-ruby public/dispatch.servlet \ No newline at end of file
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 4130f009f8..49bdd093c4 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -24,7 +24,7 @@
class Dispatcher
DEFAULT_SESSION_OPTIONS = { "database_manager" => CGI::Session::PStore, "prefix" => "ruby_sess.", "session_path" => "/" }
- def self.dispatch(cgi = CGI.new, session_options = DEFAULT_SESSION_OPTIONS, error_page = nil)
+ def self.dispatch(cgi = CGI.new, session_options = DEFAULT_SESSION_OPTIONS)
begin
request = ActionController::CgiRequest.new(cgi, session_options)
response = ActionController::CgiResponse.new(cgi)
@@ -35,14 +35,8 @@ class Dispatcher
require_dependency(controller_path(controller_name, module_name))
controller_class(controller_name).process(request, response).out
- rescue Object => e
- begin
- ActionController::Base.logger.info "\n\nException throw during dispatch: #{e.message}\n#{e.backtrace.join("\n")}"
- rescue Exception
- # Couldn't log error
- end
-
- if error_page then cgi.out{ IO.readlines(error_page) } else raise e end
+ rescue Object => exception
+ ActionController::Base.process_with_exception(request, response, exception).out
ensure
ActiveRecord::Base.reset_associations_loaded
diff --git a/railties/lib/generator.rb b/railties/lib/generator.rb
index 2f63341965..65de736751 100644
--- a/railties/lib/generator.rb
+++ b/railties/lib/generator.rb
@@ -73,7 +73,7 @@ module Generator
end
end
- # Generate model, unit test, and fixtures.
+ # Generate model, unit test, and fixtures.
class Model < Base
def generate
diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb
index 66c78fbd5f..248378cb57 100644
--- a/railties/lib/webrick_server.rb
+++ b/railties/lib/webrick_server.rb
@@ -85,7 +85,6 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
res.set_error(err)
return true
rescue => err
- p err
return false
end
end