I want to log database errors using PDO, but I do not want to have to repeatedly add logging to my catch blocks. Is there a way to force logging a PDOException?
Or would I have to create a class that extends PDO, then create a class that extends PDOExceptions and use them instead. Like the following:
try {
$dbconn = new logPDO ( ... );
//...
} catch (LogException $e ) {
//..
}
I'd like to avoid creating new classes just to work around this. It seems strange that I can't log a PDOException.