diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-05-01 16:40:39 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-05-02 10:20:54 +0100 |
commit | 0d9045ca1c6b2e2c2889e9237ed96ad689eec902 (patch) | |
tree | 82727057828531229a901de42a23dfb2357a1eb0 /app/controllers/application_controller.rb | |
parent | 0b6b29f248a74321638f5149800dac777080a95b (diff) |
Return the correct status codes for ActiveRecord::RecordNotFound, ActionController::UnknownAction, PermissionDenied and general exceptions.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d062519bc..7c9585955 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -121,6 +121,14 @@ class ApplicationController < ActionController::Base @exception_class = exception.class.to_s @exception_message = exception.message status_code = case exception + when ActiveRecord::RecordNotFound, + ActionController::UnknownAction + 404 + when PermissionDenied + 403 + else + 500 + end render :template => "general/exception_caught", :status => status_code end |