Catch MYSQL errors


#1

Hello,
How does one go about catching db errors, such as:

Mysql::Error in BlogController#index
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I’d rather render the error in my own layout (I do have one named
application)

Cheers,
Serdar Kilic
http://weblog.kilic.net/


#2

Hello,
How does one go about catching db errors, such as:

Mysql::Error in BlogController#index
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I’d rather render the error in my own layout (I do have one named
application)

Look at the specific exception that is being thrown and then deal with
it
in a begin/rescue/end block…

-philip