From 9fcb41f57d9a88d3e3fcde66dc74bbba7e452ef6 Mon Sep 17 00:00:00 2001 From: francis Date: Tue, 22 Jan 2008 17:59:50 +0000 Subject: Instead of Rails, we grab all exceptions, and show formatted 404 error with exception class. --- app/controllers/application.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/controllers/application.rb') diff --git a/app/controllers/application.rb b/app/controllers/application.rb index e01f264a2..23b6e376b 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.26 2008-01-09 19:56:01 francis Exp $ +# $Id: application.rb,v 1.27 2008-01-22 17:59:50 francis Exp $ class ApplicationController < ActionController::Base @@ -16,6 +16,18 @@ class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_foi_session_id' + # Override default error handler + def rescue_action_in_public(exception) + # do something based on exception + @exception_backtrace = exception.backtrace.join("\n") + @exception_class = exception.class.to_s + render :template => "general/exception_caught.rhtml", :status => 404 + end + + def local_request? + false + end + private # Check the user is logged in -- cgit v1.2.3