public function convertErrorsToExceptions($level = null, $exceptionClass = null)
    {
        $this->isHandledLocal = true;
        if (is_null($level)) {
            $level = E_ALL;
        }
        if (is_null($exceptionClass)) {
            $exceptionClass = static::EXCEPTION_THROW_CLASS;
        }
        set_error_handler(function ($errorNumber, $errorMessage, $errorFile, $errorLine) use ($exceptionClass) {
            throw new $exceptionClass(
                sprintf("%s in %s on line %s!", $errorMessage, $errorFile, $errorLine),
                $errorNumber
            );
        }, $level);
    }