Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restored dynamic rendering of error pages and fixed 502 error. Need t…
…o check that hoptoad notifications are still triggered once this goes to test!
- Loading branch information
Lim Lim
committed
Oct 10, 2011
1 parent
baa3f2e
commit e856645
Showing
12 changed files
with
96 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class ErrorsController < ApplicationController | ||
|
||
def method_not_allowed | ||
render :action => "403" | ||
end | ||
|
||
def forbidden | ||
render :action => "403" | ||
end | ||
|
||
def not_found | ||
render :action => "404" | ||
end | ||
|
||
def unprocessable_entity | ||
render :action => "422" | ||
end | ||
|
||
def internal_server_error | ||
render :action => "500" | ||
end | ||
|
||
def conflict | ||
render :action => "500" | ||
end | ||
|
||
def not_implemented | ||
render :action => "500" | ||
end | ||
|
||
%w(403 404 422 500 502).each do |error_code| | ||
define_method error_code.to_sym do | ||
respond_to do |format| | ||
format.html { render error_code, :status => error_code } | ||
format.any(:js) { head error_code } | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<!-- BEGIN main --> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 403</h2> | ||
<h3 class="heading">Forbidden</h3> | ||
<p>You do not have permission to access the requested file on this server.</p> | ||
</div> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 403</h2> | ||
<h3 class="heading">Forbidden</h3> | ||
<p>You do not have permission to access the requested file on this server.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<!-- BEGIN main --> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 404</h2> | ||
<h3 class="heading">The page you were looking for doesn't exist.</h3> | ||
<p>You may have mistyped the address or the page may have moved.</p> | ||
</div> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 404</h2> | ||
<h3 class="heading">The page you were looking for doesn't exist.</h3> | ||
<p>You may have mistyped the address or the page may have moved.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<!-- BEGIN main --> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 422</h2> | ||
<h3 class="heading">The change you wanted was rejected.</h3> | ||
<p>Maybe you tried to change something you didn't have access to.</p> | ||
</div> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 422</h2> | ||
<h3 class="heading">The change you wanted was rejected.</h3> | ||
<p>Maybe you tried to change something you didn't have access to.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<!-- BEGIN main --> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 500</h2> | ||
<h3 class="heading">We're sorry, but something went wrong.</h3> | ||
<p>We've been notified about this issue and we'll take a look at it shortly</p> | ||
</div> | ||
<div id="main" class="error"> | ||
<h2 class="heading">Error 500</h2> | ||
<h3 class="heading">We're sorry, but something went wrong.</h3> | ||
<p>We've been notified about this issue and we'll take a look at it shortly</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Enable handling exceptions with dynamic error pages in production | ||
# See http://accuser.cc/posts/1-rails-3-0-exception-handling | ||
require 'action_dispatch/middleware/show_exceptions' | ||
|
||
module ActionDispatch | ||
class ShowExceptions | ||
private | ||
def render_exception_with_template(env, exception) | ||
body = ErrorsController.action(rescue_responses[exception.class.name]).call(env) | ||
log_error(exception) | ||
notify_hoptoad(exception) | ||
body | ||
rescue | ||
render_exception_without_template(env, exception) | ||
end | ||
|
||
alias_method_chain :render_exception, :template if Rails.env == "production" | ||
end | ||
end | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.