コード例 #1
0
/**
 * called for caught exceptions
 * @param  AException $e
 * @return null
 */
function ac_exception_handler($e)
{
    //fix for default PHP handler call in third party PHP libraries
    if (!method_exists($e, 'logError')) {
        $e = new AException($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
    }
    if (class_exists('Registry')) {
        $registry = Registry::getInstance();
        $config = $registry->get('config');
        if (!$config || !$config->has('config_error_log') && !$config->has('config_error_display')) {
            $e->logError();
            $e->displayError();
        } else {
            if ($config->has('config_error_log') && $config->get('config_error_log')) {
                $e->logError();
            }
            if ($config->has('config_error_display') && $config->get('config_error_display')) {
                $e->displayError();
            }
        }
        return null;
    }
    $e->logError();
    $e->displayError();
}
コード例 #2
0
ファイル: exceptions.php プロジェクト: siddht1/abantecart-src
/**
 * called for caught exceptions
 * @param  AException $e
 * @return null
 */
function ac_exception_handler($e)
{
    if (class_exists('Registry')) {
        $registry = Registry::getInstance();
        if ($registry->get('force_skip_errors')) {
            return null;
        }
    }
    //fix for default PHP handler call in third party PHP libraries
    if (!method_exists($e, 'logError')) {
        $e = new AException($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
    }
    if (class_exists('Registry')) {
        $registry = Registry::getInstance();
        $config = $registry->get('config');
        if (!$config || !$config->has('config_error_log') && !$config->has('config_error_display')) {
            //we have no config or both settings are missing.
            $e->logError();
            $e->displayError();
        } else {
            if ($config->has('config_error_log') && $config->get('config_error_log')) {
                $e->logError();
            }
            if ($config->has('config_error_display') && $config->get('config_error_display')) {
                $e->displayError();
            }
        }
        //do we have fatal error and need to end?
        if ($e->errorCode() >= 10000 && !defined('INSTALL')) {
            $e->showErrorPage();
        } else {
            //nothing critical
            return null;
        }
    }
    //no registry, something totaly wrong
    $e->logError();
    $e->displayError();
    $e->showErrorPage();
}