Taking Control of Un-handled Exceptions

Greetings,

I’m trying to catch all un-handled exceptions. I’m having problems
handling the RoutingError and UnknownAction exceptions.

I’ve added the following to my application controller as a protected
method:

def rescue_action(exception)
render(:text => “error”)
end

As far as I understand, this should catch all uncaught exceptions and
override the rails default “rescue_action” method.

However, anytime a RoutingError occurs, the “app_root/public/404.html”
file gets displayed. The rescue_action method doesn’t even get called.
Am I doing something wrong? Any suggestions?

Thanks,
Steven

On Jun 30, 2006, at 6:00 PM, Steven H. wrote:

I’m trying to catch all un-handled exceptions. I’m having problems
handling the RoutingError and UnknownAction exceptions.

I’ve added the following to my application controller as a
protected method:

def rescue_action(exception)
render(:text => “error”)
end

I think you want the rails list.


Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs