private void reportError(XPathException exception) throws XPathException {
        errorCount++;
        if (firstError == null) {
            firstError = exception;
        }
        ((QueryModule)env).reportFatalError(exception);
        throw exception;
    }