src/ErrorHandler.php
public function onError($code, $message, $file, $line)
    {
        $this->lastError = [
            'message' => $message,
            'file' => $file,
            'line' => $line
        ];

        $trace = debug_backtrace();
        if (count($trace) > 0 && !isset($trace[0]['file'])) {
            array_shift($trace);
        }

        switch ($code) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $exc = new Errors\Notice($message, $trace);
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $exc = new Errors\Warning($message, $trace);
                break;
            case E_ERROR:
            case E_CORE_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_USER_ERROR:
                $exc = new Errors\Fatal($message, $trace);
                break;
            default:
                $exc = new Errors\Error($message, $trace);
                break;
        }
        $this->notifier->notify($exc);
        return false;
    }
public function onError($code, $message, $file, $line)
    {
        $this->lastError = [
            'message' => $message,
            'file' => $file,
            'line' => $line
        ];

        $trace = debug_backtrace();
        if (count($trace) > 0 && !isset($trace[0]['file'])) {
            array_shift($trace);
        }

        switch ($code) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $exc = new Errors\Notice($message, $trace);
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $exc = new Errors\Warning($message, $trace);
                break;
            case E_ERROR:
            case E_CORE_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_USER_ERROR:
                $exc = new Errors\Fatal($message, $trace);
                break;
            default:
                $exc = new Errors\Error($message, $trace);
                break;
        }
        $this->notifier->notify($exc);
        return false;
    }
public function onError ( $ code , $ message , $ file , $ line ) { $ this -> lastError = [ 'message' => $ message , 'file' => $ file , 'line' => $ line ] ; $ trace = debug_backtrace ( ) ; if ( count ( $ trace ) > 0 && ! isset ( $ trace [ 0 ] [ 'file' ] ) ) { array_shift ( $ trace ) ; } switch ( $ code ) { case E_NOTICE : case E_USER_NOTICE : $ exc = new Errors \ Notice ( $ message , $ trace ) ; break ; case E_WARNING : case E_USER_WARNING : $ exc = new Errors \ Warning ( $ message , $ trace ) ; break ; case E_ERROR : case E_CORE_ERROR : case E_RECOVERABLE_ERROR : case E_USER_ERROR : $ exc = new Errors \ Fatal ( $ message , $ trace ) ; break ; default : $ exc = new Errors \ Error ( $ message , $ trace ) ; break ; } $ this -> notifier -> notify ( $ exc ) ; return false ; }
PHP error handler that notifies Airbrake about errors. Should be used
with set_error_handler.
PHP error handler that notifies Airbrake about errors . Should be used with set_error_handler .