Permalink
Browse files

Added better exception handling

  • Loading branch information...
1 parent 2033552 commit 1d8ceb2e2ce6b1db2c23d9af57295b5f66370768 @accuser accuser committed Mar 5, 2011
@@ -9,8 +9,8 @@ class ApplicationController < ActionController::Base
theme :current_theme
before_filter :correct_safari_and_ie_accept_headers
-
- protected
+
+ protected
def add_breadcrumb(name, url = '')
@breadcrumbs ||= []
url = eval(url) if url =~ /_path|_url|@/
@@ -123,6 +123,15 @@ def found_wiki_page(wiki_page)
end
end
+ def rescue_action_in_public(exception)
+ case response_code_for_rescue(exception)
+ when :not_found
+ render "errors/not_found", :status => :not_found
+ else
+ render "errors/internal_server_error", :status => :internal_server_error
+ end
+ end
+
def correct_safari_and_ie_accept_headers
request.accepts.sort!{ |x, y| y.to_s == 'text/javascript' ? 1 : -1 } if request.xhr?
end
@@ -0,0 +1,4 @@
+- content_for :content_header do
+ %h1 Don't Panic
+%p
+ We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly.
@@ -0,0 +1,6 @@
+- content_for :content_header do
+ %h1 Don't Panic
+%p
+ The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
+- form_tag(search_index_path, :method => :get) do
+ = text_field_tag :q, 'Search', :onclick => 'if(this.value=="Search"){this.value=""}', :onblur => 'if(this.value==""){this.value="Search"}'

0 comments on commit 1d8ceb2

Please sign in to comment.