# Taking Control of Un-handled Exceptions

**URL:** <https://www.ruby-forum.com/t/taking-control-of-un-handled-exceptions/96725>\
**Category:** Ruby\
**Created:** [July 1, 2006, 3:13am UTC](https://www.ruby-forum.com/t/taking-control-of-un-handled-exceptions/96725 "2006-07-01T03:13:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@rooster](https://www.ruby-forum.com/u/rooster)\
**Post date:** [July 1, 2006, 3:13am UTC](https://www.ruby-forum.com/t/taking-control-of-un-handled-exceptions/96725/1 "2006-07-01T03:13:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rooster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@rooster](https://www.ruby-forum.com/u/rooster)\
**Post date:** [July 1, 2006, 7:43am UTC](https://www.ruby-forum.com/t/taking-control-of-un-handled-exceptions/96725/2 "2006-07-01T07:43:59Z")

</div>

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. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
