Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

major rework of the error handling

  • Loading branch information...
commit 2b0ccaa7663ff94fcded5b0ad6735995778a5a88 1 parent e7633ea
erik authored
View
8 app/controllers/application_controller.rb
@@ -103,12 +103,6 @@ def load_classes
Citizen
end
- def display_404
- @page_not_found = true
- render :file => "pages/notfound", :use_full_path => true, :layout => true, :status => 404, :page_not_found=>true
- return
- end
-
def social_notifier
if current_user
if cookies[:social_notifier_shown]
@@ -361,6 +355,7 @@ def award_redeem_credits_if_any
private
def render_not_found(exception = nil)
+ @page_not_found = true
log_error(exception) if exception
can_create? if params[:action] == "new" || params[:action] == "create"
can_edit? if params[:action] == "edit" || params[:action] == "update" || params[:action] == "destroy"
@@ -376,6 +371,7 @@ def render_not_found(exception = nil)
end
def render_error(exception = nil)
+ @exception_found = true
log_error(exception) if exception
can_create? if params[:action] == "new" || params[:action] == "create"
can_edit? if params[:action] == "edit" || params[:action] == "update" || params[:action] == "destroy"
View
2  app/controllers/pitches_controller.rb
@@ -40,7 +40,7 @@ def show
@pitch = get_pitch
if @pitch.blank?
- display_404
+ render_not_found
return
end
View
9 app/views/errors/404.html.erb
@@ -1,6 +1,7 @@
<div class="contentContainer" style=" width:700px; float:left; padding: 20px 20px 40px 0;">
- <h2>Page not found</h2>
- <p style="padding-left:10px;">
- We could not find that page.
- </p>
+ <p style="padding-left:10px">The web page you were attempting to view may not exist, may have moved or may have been taken down.</p>
+
+ <p style="padding-left:10px">Try checking the web address for typos.</p>
+
+ <p style="padding-left:10px">Or you can try to find some <a href="/stories/unfunded" title="unfunded stories">unfunded stories</a> or use the search on top to find the page you were looking for.</p>
</div>
View
1  app/views/errors/500.html.erb
@@ -1,5 +1,4 @@
<div class="contentContainer" style=" width:700px; float:left; padding: 20px 20px 40px 0;">
- <h2>Oops, something went wrong</h2>
<p style="padding-left:10px;">
If the error is persistent, please contact us.
</p>
View
2  app/views/layouts/application.html.erb
@@ -45,7 +45,7 @@
<%if File.exists?("#{RAILS_ROOT}/app/views/#{params[:controller]}/_header.html.erb")%>
<div class='middleWrapper'>
<div class='innerWrapper'>
- <%if @page_not_found%>
+ <%if @page_not_found || @exception_found %>
<%= render :partial => "pages/header"%>
<%else%>
<%= render :partial => "header" %>
View
2  app/views/pages/_header.html.erb
@@ -5,6 +5,8 @@
<h1>Spot.us Privacy Policy</h1>
<%elsif @page_not_found%>
<h1>Sorry, we couldn't find that page!</h1>
+ <%elsif @exception_found%>
+ <h1>Oops, something went wrong!</h1>
<%else%>
<h1 rel="nofollow"><%=@page ? @page.title : params[:id].to_s%></h1>
<p>Pioneering community-funded reporting</p>
Please sign in to comment.
Something went wrong with that request. Please try again.