コード例 #1
0
function exception_handler($e)
{
    if (!$e instanceof \OutOfBoundsException) {
        try {
            $err = Lampcms\Responder::makeErrorPage('<strong>Error:</strong> ' . Lampcms\Exception::formatException($e));
            $extra = isset($_SERVER) ? ' $_SERVER: ' . print_r($_SERVER, 1) : ' no extra';
            if (defined('LAMPCMS_DEVELOPER_EMAIL') && strlen(trim(constant('LAMPCMS_DEVELOPER_EMAIL'))) > 1) {
                @mail(LAMPCMS_DEVELOPER_EMAIL, 'ErrorHandle in inc.php', $err . $extra);
            }
            echo $err;
        } catch (\Exception $e) {
            echo 'Error in Exception handler: : ' . $e->getMessage() . ' line ' . $e->getLine() . $e->getTraceAsString();
        }
    } else {
        d('Got exit signal in error_handler from ' . $e->getTraceAtString());
    }
}
コード例 #2
0
ファイル: !inc.php プロジェクト: codigoirreverente/LampCMS
function exception_handler($e)
{
    $code = $e->getCode();
    if (!$e instanceof \OutOfBoundsException) {
        try {
            $err = Lampcms\Responder::makeErrorPage('<strong>Error:</strong> ' . Lampcms\Exception::formatException($e));
            $extra = isset($_SERVER) ? ' $_SERVER: ' . print_r($_SERVER, 1) : ' no extra';
            if ($code >= 0 && defined('LAMPCMS_DEVELOPER_EMAIL') && strlen(trim(constant('LAMPCMS_DEVELOPER_EMAIL'))) > 7) {
                @mail(LAMPCMS_DEVELOPER_EMAIL, 'ErrorHandle in inc.php', $err . $extra);
            }
            echo nl2br($err);
        } catch (\Exception $e) {
            echo 'Error in Exception handler: : ' . $e->getMessage() . ' line ' . $e->getLine() . $e->getTraceAsString();
        }
    } else {
        echo 'Got exit signal in error_handler. Exception: ' . get_class($e) . ' Error ' . $e->getMessage() . ' in:  ' . $e->getFile() . ' line: ' . $e->getLine() . "\n<br>Trace: " . $e->getTraceAsString();
    }
}