views:

216

answers:

1

This is probably very simple but I can't figure out why I get no error pages.

First off, I'm using Heroku for hosting, so it's definitely in production mode.

If I set the line "config.action_controller.consider_all_requests_local" set to true, I get a detailed error message but otherwise, I get a completely 100% blank screen. If I view the source, also blank.

All my 404,422,500.html files are in public and I haven't touched them.

And they seem to work on my local machine if I start in production mode there. So it must have to do with Heroku? Any ideas?

The logs tell me nothing useful.

Below is the details of the production.rb file

config.cache_classes = true

#ActionMailer::Base.delivery_method = :sendmail
Paperclip.options[:command_path] = "/usr/bin/"

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

# set delivery method to :smtp, :sendmail or :test
config.action_mailer.delivery_method = :smtp

# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching             = true
config.action_view.cache_template_loading            = true
+3  A: 

I don't think Heroku uses the .html files like Passenger or Mongrel do. You may need to catch and handle your own exceptions through two basic mechanisms:

  • Create an exception handler with rescue_from in your ApplicationController for anything that might explode, both specifically and up to and including Object.
  • Create a default route to catch anything that isn't otherwise routed.

If you bust out of your routing table, or trigger a "500" error, it's because of exceptions. These need to be handled or you'll get a blank screen unless the web server is configured otherwise.

Apache can be configured to do this with the ErrorDocument directive.

tadman
You're probably right. I added a rescue_action_in_public method and it seems to do the job, but I'm still wondering if there's a better way that re=inventing the wheel myself?
holden