Add better log messages
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user