Skip to content

Commit d572551

Browse files
committed
Safely check for out of date databases
When checking to re-import test databases, if the target database is missing or otherwise unavailable, avoid the check and just continue. This avoids a bug where a user would delete a test database and there would be an error when trying to run a query.
1 parent 752ec04 commit d572551

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

extensions/ql-vscode/src/databases/local-databases/database-manager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,16 @@ export class DatabaseManager extends DisposableObject {
227227
"codeql-database.yml",
228228
);
229229

230+
let originStat;
231+
try {
232+
originStat = await stat(originDbYml);
233+
} catch (e) {
234+
// if there is an error here, assume that the origin database
235+
// is no longer available. Safely ignore and do not try to re-import.
236+
return false;
237+
}
238+
230239
try {
231-
const originStat = await stat(originDbYml);
232240
const importedStat = await stat(importedDbYml);
233241
return originStat.mtimeMs > importedStat.mtimeMs;
234242
} catch (e) {

0 commit comments

Comments
 (0)