I want to add in some handling for a specific exception
Zend_Db_Statement_Exception' with message
'SQL ERROR: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
I'd prefer to do string comparison against the exception message somewhere fairly low-level, so that in my application logic, I can simply catch a nice friendly exception like My_Module_Exception_MysqlGoneAway, as opposed to having catch exception clauses with string comparison in them strewn about my application logic.
So in this particular case, the error is being triggered from a load() method, so I could go rewrite Mage_Core_Model_Abstract, overload the load() method and add in the exception handling. But that's not bulletproof, b/c this kind of thing could also be triggered from a collection load or probably other areas of code.
So the other option would be to override lib/Varien/Db/Adapter/Pdo/Mysql.php in app/code/local, and add the exception handling there, but that seems a bit like overkill just to have a nice exception class.
Is there any easier way to do this?