/** * Retourne la première erreur typé de la chaine d'exception. * @param \Exception $oException * @return \Exception */ public static function getCause($oException) { $oExTmp = $oException; while (!empty($oExTmp->getPrevious())) { $oExTmp = $oExTmp->getPrevious(); switch ($oExTmp) { case $oExTmp instanceof \Commun\Exception\BnetException: return ParseException::getFirstCauseRtk($oExTmp); break; case $oExTmp instanceof \Commun\Exception\DatabaseException: return ParseException::getFirstCauseRtk($oExTmp); break; default: } } return $oExTmp; }