Catching Errnos in Controller

I want to write a code in the controller that will catch the Errnos. For
some reason I’m not able to do that. I’m thinking Rails is cataching
them before it even gets to the controller and throws out the error
page. For example, if mysql server isn’t running I want to catch that
err and show something else besides the standard error page. Is there a
way? Thanks.