[PATCH conductor 1/3] Set 500 status code for internal server error pages

Scott Seago sseago at redhat.com
Tue Jul 10 18:18:10 UTC 2012


We had a custom handler for internal server errors, but they
were still coming through with 200 Success http status. This prevented
me from writing a test case to verify a recent fix, and it allowed at
least one old no-longer-valid test case for user creation to continue
passing even though it exhibited failure.
---
 src/app/controllers/application_controller.rb |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index d5da863..477b7f4 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -70,7 +70,8 @@ class ApplicationController < ActionController::Base
 
   def handle_general_error(error)
     handle_error(:error => error, :status => :internal_server_error,
-                 :title => t('application_controller.internal_server_error'))
+                 :title => t('application_controller.internal_server_error'),
+                 :status => 500)
   end
 
   def handle_error(hash)
@@ -93,7 +94,8 @@ class ApplicationController < ActionController::Base
     else
       flash.now[:error] = msg
       render :template => 'layouts/error', :layout => 'application',
-             :locals => {:title => title, :errmsg => ''}
+             :locals => {:title => title, :errmsg => ''},
+             :status => status
     end
   end
 
-- 
1.7.6.5




More information about the aeolus-devel mailing list