# Catching routing errors

**URL:** <https://www.ruby-forum.com/t/catching-routing-errors/96533>\
**Category:** Rails\
**Created:** [June 29, 2006, 12:46pm UTC](https://www.ruby-forum.com/t/catching-routing-errors/96533 "2006-06-29T12:46:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [June 29, 2006, 12:46pm UTC](https://www.ruby-forum.com/t/catching-routing-errors/96533/1 "2006-06-29T12:46:29Z")

</div>

Hello, I wonder how to avoid routing error message by displaying (when  
in production mode) a customized error page ?

In fact, how do I catch a routing error ?

Thank you

---

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [June 29, 2006, 3:55pm UTC](https://www.ruby-forum.com/t/catching-routing-errors/96533/2 "2006-06-29T15:55:46Z")

</div>

write unit tests to verify the routing config. I always add a catch-all  
which takes the user to the home page in case of routing error.

---

<div class="post-metadata">

**Author:** ![nuno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/65b543/32.png) [@nuno](https://www.ruby-forum.com/u/nuno)\
**Post date:** [June 29, 2006, 5:43pm UTC](https://www.ruby-forum.com/t/catching-routing-errors/96533/3 "2006-06-29T17:43:39Z")

</div>

Neeraj K. wrote:

> write unit tests to verify the routing config. I always add a catch-all  
> which takes the user to the home page in case of routing error.

Ok, that what that simple ! Thank you…

My catch all is at the end of the route.rb file

map.connect ‘\*path’ , :controller =\> ‘welcome’ , :action =\> ‘bad\_route’

# catch all !
