public function handleFatal()
    {
        $error = $this->getLastError();
        if ($error === null) return;

        unset($this->reservedMemory);
        $type = $error['type'];
        if ( $this->level === 0 || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
            return;
        }

        // get current exception handler
        $exceptionHandler = set_exception_handler(function() {});
        restore_exception_handler();

        if (
            is_array($exceptionHandler) &&
            $exceptionHandler[0] instanceof Error
        ) {
            $this->generateErrorException($type, $error['message'], $error['file'], $error['line']);
        }
    }