Skip to content

Commit

Permalink
render error page for all exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom committed Dec 18, 2012
1 parent 3287b07 commit 63536af
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ class MissingParameterError < Exception; end

protected

rescue_from MissingParameterError do |exception|
rescue_from Exception do |exception|
logger.error "Exception: #{exception.class}: #{exception.message}"
logger.error exception.backtrace.join("\n")
@message = exception.message
if request.xhr?
render :template => "error", :layout => false, :status => 400
else
render :template => 'error', :layout => "application", :status => 400
end
layout = request.xhr? ? false : "application"
notify_hoptoad(exception)
render :template => 'error', :layout => layout, :status => 400
end

def set_language
Expand Down

2 comments on commit 63536af

@coolo
Copy link
Member

@coolo coolo commented on 63536af Dec 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still has the problem that it will look for error.png if the exception happens during .png rendering

@digitaltom
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll look into that

Please sign in to comment.