Handle all the unhandled exceptions

I was just thinking, how do i go about this.
In the latest edition of AWDR, DHH talk about something like this.But i
guess, that part of text is still not written.
So any clues?


nothing much to talk

And where should i define this method?

I have defined this method in application.rb.But it doesn’t seem to
catch
all errors. Or is it that, i must run in production mode to use this
method?

On 8/22/06, Jeremy K. [email protected] wrote:

def rescue_action_in_public(exception)
logger.error “Ooops: #{exception}”
redirect_to home_url
end

jeremy


nothing much to talk

On 8/22/06, hemant [email protected] wrote:

And where should i define this method?

I have defined this method in application.rb.But it doesn’t seem to catch
all errors. Or is it that, i must run in production mode to use this method?

It’s a controller instance method, so defining it in
ApplicationController
will affect all of your controllers, as you expect.

The method is only called when local_request? is true (dev mode), so
switch
to production to see the error page, or set
config.action_controller.consider_all_requests_local = false
in config/environments/development.rb

jeremy

On 8/21/06, hemant [email protected] wrote:

I was just thinking, how do i go about this.
In the latest edition of AWDR, DHH talk about something like this.But i
guess, that part of text is still not written.
So any clues?

http://api.rubyonrails.com/classes/ActionController/Rescue.html#M000069

def rescue_action_in_public(exception)
logger.error “Ooops: #{exception}”
redirect_to home_url
end

jeremy