コード例 #1
0
ファイル: Test_Error.php プロジェクト: im286er/Ding
 public function onDingError(ErrorInfo $error)
 {
     self::$error = $error;
     self::$handled = true;
 }
コード例 #2
0
ファイル: MyBootstrap.php プロジェクト: robksawyer/grabitdown
/**
 * own shutdown function - also logs fatal errors (necessary until cake2.2)
 * 2010-10-17 ms
 */
function shutDownFunction()
{
    $error = error_get_last();
    if (empty($error)) {
        return;
    }
    $matching = array(E_ERROR => 'E_ERROR', E_WARNING => 'E_WARNING', E_PARSE => 'E_', E_NOTICE => 'E_', E_CORE_ERROR => 'E_', E_COMPILE_ERROR => 'E_', E_COMPILE_WARNING => 'E_', E_STRICT => 'E_STRICT', E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', E_DEPRECATED => 'E_DEPRECATED');
    App::uses('CakeLog', 'Log');
    if (in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR))) {
        $error['type_name'] = 'Fatal Error';
        $type = 'error';
    } elseif (Configure::read('Debug.log') && isset($matching[$error['type']])) {
        $error['type_name'] = 'Error';
        $type = 'notice';
    }
    if (!isset($type)) {
        return;
    }
    App::uses('Debugger', 'Utility');
    $trace = Debugger::trace(array('start' => 1, 'format' => 'log', 'args' => true));
    $path = Debugger::trimPath($error['file']);
    $message = $error['type_name'] . ' ' . $matching[$error['type']] . ' in ' . $path . ' (line ' . $error['line'] . '): ' . $error['message'];
    $message .= PHP_EOL . $trace;
    App::uses('MyErrorHandler', 'Tools.Error');
    $message .= MyErrorHandler::traceDetails();
    CakeLog::write($type, $message);
}