Error Handling and 404 pages

Hi,

If I try to enter a url that doesn't exist in my app, I get error
messages such as unknown action or routing error or.... but not my 404
page. How do I set that 404 page will come up?

Also, if I install exception_notification plugin (as in AWDROR page
627), would it still send me an email when a user gets 404 pages?

Elle

If I try to enter a url that doesn't exist in my app, I get error
messages such as unknown action or routing error or.... but not my 404
page. How do I set that 404 page will come up?

Also, if I install exception_notification plugin (as in AWDROR page
627), would it still send me an email when a user gets 404 pages?

This should happen automatically if your site is in production mode. In development mode it will report the actual error.

Yes, in production mode you will get the email from exception_notification for 404 pages. And for 500 errors as well like you'd expect.

Thats good to know.

Thanks,
Elle

If I try to enter a url that doesn't exist in my app, I get error
messages such as unknown action or routing error or.... but not my 404
page. How do I set that 404 page will come up?

Philip Hallstrom wrote:
This should happen automatically if your site is in production mode. In
development mode it will report the actual error.

Except... that in my sites in production mode (1.2.6), it doesn't serve
the 404 -- still serves the raw error message. :frowning:

Doing some googling, and it seems like there's a lot of gymnastics being
suggested for devs to write code to deal with this themselves, Clearly
the framework should be handling this on its own. If it is supposed to
be doing it in production mode, something is broken in my set up.

-- gw

I’m guessing here you’re acessing your site:

a) whilst it’s still in development mode, or;
b) whilst it’s in production mode, but using either http://localhost or http://127.0.0.1.

Try using a different address (i.e. 192.168.0.2) and gaze in awe at the fantasticity of 500.html.

'fraid not – I have a server in a datacenter, and I’m whacking it from home. I get Missing Action errors.

I’ll grant there’s something funky going on though, as all anecdotal evidence points to this should be working as advertised.

I’ll noodle on it…

– gw

Make triple quadruple expontentially infinitely sure you’re not running in development mode. Show me the line in config/environment.rb, the one that reads “RAILS_ENV = [something]”.

Whoa... crazy. Checked off the all the logical things (config files), then started on the less-likely candidates and it turns out my VPN connection to the server short circuits everything, and Rails somehow sees my requests from my home system to my server as being local. Disconnect VPN, and I get the expected the 404.html page. Weird.

-- gw

How is the VPN setup in regards to serving the requests?

Rails -> Mongrel -> ?

The VPN has no intentional relationship to the serving of Rails apps at all.

I have a couple handfuls of servers at a data center to which I connect via VPN to manage.

At the time I was seeing Missing Action error messages on public/production sites, I happened to be connected. I was using my dev system to enter the normal public URLs of the sites just as anyone else would have to.

The sites themselves are on OS X 10.5, Rails 1.2.6, Mongrel (via mongrel_cluster started by monit), and the built-in Apache 2.2 using proxy balancer. No changes to the default environment files except for including some custom libs and declaring a few constants in environment.rb.

-- gw