/** * Creates a new instance of Anoa_Error based on the * passed exception. * * @param Exception $e Any exception that should be casted * to an instance of Anoa_Error * * @return Anoa_Error */ public static function fromException(Exception $e, $errorClass = 'Pandamp_Error') { switch ($errorClass) { case 'Pandamp_Error': $error = new Pandamp_Error(); break; case 'Pandamp_Error_Form': //$error = new Pandamp_Error_Form(); break; } $error->setCode($e->getCode()); $error->setMessage($e->getMessage()); $error->setFile($e->getFile()); $error->setLine($e->getLine()); $error->setType(get_class($e)); return $error; }