Example #1
0
/**
 * Returns the detailled error message of an PEAR_Error or an Exception
 *
 * @param PEAR_Error|Exception $error Error object
 *
 * @return string Detailled error message
 */
function get_detail_error_msg($error)
{
    if ($error instanceof Exception) {
        $msg = $error->__toString();
    } else {
        if ($error instanceof PEAR_Error) {
            $msg = $error->getMessage() . '... ' . $error->getUserInfo();
        } else {
            $msg = (string) $error;
        }
    }
    return $msg;
}