* @category Horde * @license http://www.horde.org/licenses/apache ASL * @package Ingo */ /** * Ingo exception class that converts PEAR errors to exceptions. * * @author Jan Schneider * @category Horde * @license http://www.horde.org/licenses/apache ASL * @package Ingo */ class Ingo_Exception_Pear extends Horde_Exception_Pear { /** * Exception handling. * * @param mixed $result The result to be checked for a PEAR_Error. * * @return mixed Returns the original result if it was no PEAR_Error. * * @throws Ingo_Exception In case the result was a PEAR_Error. */ static public function catchError($result) { if ($result instanceof PEAR_Error) { throw new Ingo_Exception(new self::$_class($result)); } return $result; } }