This commit is contained in:
alexet 2021-01-27 18:18:34 +00:00 коммит произвёл Andrew Eisenberg
Родитель fbff2df899
Коммит 4dfec7014c
3 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -475,7 +475,7 @@ export interface CompileUpgradeResult {
error?: string;
}
export interface CompiledUpgradeSequence {
export interface CompileUpgradeSequenceResult {
/**
* The compiled upgrades as a single file.
*/
@ -1006,7 +1006,7 @@ export const compileUpgrade = new rpc.RequestType<WithProgressId<CompileUpgradeP
/**
* Compile an upgrade script to upgrade a dataset.
*/
export const compileUpgradeSequence = new rpc.RequestType<WithProgressId<CompileUpgradeSequenceParams>, CompiledUpgradeSequence, void, void>('compilation/compileUpgradeSequence');
export const compileUpgradeSequence = new rpc.RequestType<WithProgressId<CompileUpgradeSequenceParams>, CompileUpgradeSequenceResult, void, void>('compilation/compileUpgradeSequence');
/**
* Clear the cache of a dataset

Просмотреть файл

@ -17,7 +17,6 @@ import * as config from './config';
import { DatabaseItem } from './databases';
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage } from './helpers';
import { ProgressCallback, UserCancellationException } from './commandRunner';
import * as helpers from './helpers';
import { DatabaseInfo, QueryMetadata, ResultsPaths } from './pure/interface-types';
import { logger } from './logging';
import * as messages from './pure/messages';
@ -331,7 +330,7 @@ async function checkDbschemeCompatibility(
}
function reportNoUpgradePath(query: QueryInfo) {
throw new Error(`Query ${query.program.queryPath} expects database scheme ${query.queryDbscheme}, but the current database has a different scheme, and no database upgrades are available. The current database scheme may be newer than the CodeQL query libraries in your workspace. Please try using a newer version of the query libraries.`);
throw new Error(`Query ${query.program.queryPath} expects database scheme ${query.queryDbscheme}, but the current database has a different scheme, and no database upgrades are available. The current database scheme may be newer than the CodeQL query libraries in your workspace.\n\nPlease try using a newer version of the query libraries.`);
}
/**
@ -344,7 +343,7 @@ async function compileNonDestructiveUpgrade(
progress: ProgressCallback,
token: CancellationToken,
): Promise<string> {
const searchPath = helpers.getOnDiskWorkspaceFolders();
const searchPath = getOnDiskWorkspaceFolders();
if (!query.dbItem?.contents?.dbSchemeUri) {
throw new Error('Database is invalid, and cannot be upgraded.');
@ -577,7 +576,7 @@ export async function compileAndRunQueryAgainstDatabase(
if (result.resultType !== messages.QueryResultType.SUCCESS) {
const message = result.message || 'Failed to run query';
logger.log(message);
helpers.showAndLogErrorMessage(message);
showAndLogErrorMessage(message);
}
return {
query,

Просмотреть файл

@ -39,12 +39,12 @@ export async function compileDatabaseUpgradeSequence(qs: qsClient.QueryServerCli
resolvedSequence: string[],
currentUpgradeTmp: tmp.DirResult,
progress: ProgressCallback,
token: vscode.CancellationToken): Promise<messages.CompiledUpgradeSequence> {
token: vscode.CancellationToken): Promise<messages.CompileUpgradeSequenceResult> {
if (db.contents === undefined || db.contents.dbSchemeUri === undefined) {
throw new Error('Database is invalid, and cannot be upgraded.');
}
if (!hasNondestructiveUpgradeCapabilities(qs)) {
throw new Error('The version of codeql is to old to run non-destructive upgrades.');
if (!await hasNondestructiveUpgradeCapabilities(qs)) {
throw new Error('The version of codeql is too old to run non-destructive upgrades.');
}
// If possible just compile the upgrade sequence
return await qs.sendRequest(messages.compileUpgradeSequence, {