yii\base\ErrorHandler::handleError PHP Method

handleError() public method

This method is used as a PHP error handler. It will simply raise an ErrorException.
public handleError ( integer $code, string $message, string $file, integer $line ) : boolean
$code integer the level of the error raised.
$message string the error message.
$file string the filename that the error was raised in.
$line integer the line number the error was raised at.
return boolean whether the normal error handler continues.
    public function handleError($code, $message, $file, $line)
    {
        if (error_reporting() & $code) {
            // load ErrorException manually here because autoloading them will not work
            // when error occurs while autoloading a class
            if (!class_exists('yii\\base\\ErrorException', false)) {
                require_once __DIR__ . '/ErrorException.php';
            }
            $exception = new ErrorException($message, $code, $code, $file, $line);
            // in case error appeared in __toString method we can't throw any exception
            $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
            array_shift($trace);
            foreach ($trace as $frame) {
                if ($frame['function'] === '__toString') {
                    $this->handleException($exception);
                    if (defined('HHVM_VERSION')) {
                        flush();
                    }
                    exit(1);
                }
            }
            throw $exception;
        }
        return false;
    }