My question is specific to php, but i think it can be useful in other languages.
I log into a table all the exception a code can throw:
try{
//Some code
} catch (Exception $e) {
$log = new Log(basename($_SERVER['PHP_SELF']), $_SESSION['id'], LogType::EXCEPTION, $e);
try {
$log ->addLog();
} catch (Exception $e2) {
//
}
}
The function addLog insert the exception informations into a database. But (by example if the connection with the database is lost) this function can throw an exception. I can't see what i have to do with this exception except ignoring it.
I know ignoring exception is a bad practice, but what can i do in this particular case?
If there is no problem to ignore it, is there a better way to indicate that this exception should not be taken into account?