diff options
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | spec/integration/errors_spec.rb | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d4ab6bd01..2615b61f2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -135,6 +135,10 @@ class ApplicationController < ActionController::Base when PermissionDenied @status = 403 else + message = "\n#{@exception_class} (#{@exception_message}):\n" + backtrace = Rails.backtrace_cleaner.clean(exception.backtrace, :silent) + message << " " << backtrace.join("\n ") + Rails.logger.fatal("#{message}\n\n") ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver @status = 500 end diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb index ccf3c4379..f85186b3d 100644 --- a/spec/integration/errors_spec.rb +++ b/spec/integration/errors_spec.rb @@ -53,7 +53,6 @@ describe "When errors occur" do end end - it "should render a 500 for general errors using the general/exception_caught template" do InfoRequest.stub!(:find_by_url_title!).and_raise("An example error") get("/request/example") @@ -71,6 +70,12 @@ describe "When errors occur" do mail.body.should =~ /An example error/ end + it 'should log a general error' do + Rails.logger.should_receive(:fatal) + InfoRequest.stub!(:find_by_url_title!).and_raise("An example error") + get("/request/example") + end + it 'should assign the locale for the general/exception_caught template' do InfoRequest.stub!(:find_by_url_title!).and_raise("An example error") get("/es/request/example") |