How can I handle this kind of exceptions (in Doctrine)

Posted by ppavlovic on Stack Overflow See other posts from Stack Overflow or by ppavlovic
Published on 2011-01-16T19:03:22Z Indexed on 2011/01/16 21:53 UTC
Read the original article Hit count: 145

Filed under:
|
|

Can you tell me how can I handle this kind of exceptions:

Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 110' in ...

It happens when connection with MySQL is lost during query. I need to handle this exception so I can show 500 error page so the crawlers do not cache page, and to redirect user to appropriate "Try again" page.

P.S. I have a lot's of code, so I can not go trough all code to put try/catch block. I need something simple and yet effective.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql