aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application.rb14
-rw-r--r--app/views/general/exception_caught.rhtml12
2 files changed, 25 insertions, 1 deletions
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
diff --git a/app/views/general/exception_caught.rhtml b/app/views/general/exception_caught.rhtml
new file mode 100644
index 000000000..6db1e7d34
--- /dev/null
+++ b/app/views/general/exception_caught.rhtml
@@ -0,0 +1,12 @@
+<h1>Sorry, we couldn't find that page</h1>
+
+<p>You've requested a page which doesn't exist, or which we have moved.
+Perhaps you mistyped the address? Other things you can try:</p>
+
+<ul>
+<li>Go to <a href="/">our front page</a></li>
+<li><a href="mailto:<%=contact_email%>">Email us</a> to tell us about
+ the problem</li>
+</ul>
+
+<p id="error_technical_details"><strong>Technical details:</strong> <%=@exception_class ? @exception_class : "Unknown"%></p>