Add better log messages

This commit is contained in:
Andrew Eisenberg
2024-03-12 14:50:59 -07:00
parent f84f792c5f
commit 2d85018d1d
3 changed files with 14 additions and 4 deletions

View File

@@ -318,7 +318,9 @@ export async function importLocalDatabase(
await commandManager.execute("codeQLDatabases.focus");
void showAndLogInformationMessage(
extLogger,
"Database unzipped and imported successfully.",
origin.type === "testproj"
? "Test database imported successfully."
: "Database unzipped and imported successfully.",
);
}
return item;

View File

@@ -755,13 +755,12 @@ export class DatabaseUI extends DisposableObject {
// Check if the database is already in the workspace. If
// so, delete it first before importing the new one.
const existingItem = this.databaseManager.findTestDatabase(uri);
const baseName = basename(uri.fsPath);
if (existingItem !== undefined) {
progress({
maxStep: 9,
step: 1,
message: `Removing existing test database ${basename(
uri.fsPath,
)}`,
message: `Removing existing test database ${baseName}`,
});
await this.databaseManager.removeDatabaseItem(existingItem);
}
@@ -774,6 +773,14 @@ export class DatabaseUI extends DisposableObject {
progress,
this.queryServer.cliServer,
);
if (existingItem !== undefined) {
progress({
maxStep: 9,
step: 9,
message: `Successfully re-imported ${baseName}`,
});
}
} catch (e) {
// rethrow and let this be handled by default error handling.
throw new Error(

View File

@@ -256,6 +256,7 @@ export class DatabaseManager extends DisposableObject {
dateAdded: Date.now(),
language: dbItem.language,
origin: dbItem.origin,
extensionManagedLocation: dbItem.extensionManagedLocation,
});
await this.addDatabaseItem(newDbItem);
await this.setCurrentDatabaseItem(newDbItem);