Skip to content

Commit 7135d39

Browse files
Log error message
1 parent fa773a0 commit 7135d39

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

extensions/ql-vscode/src/common/vscode/file-path-discovery.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
getOnDiskWorkspaceFolders,
1717
getOnDiskWorkspaceFoldersObjects,
1818
} from "./workspace-folders";
19+
import { getErrorMessage } from "../../pure/helpers-pure";
1920

2021
interface PathData {
2122
path: string;
@@ -163,7 +164,9 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
163164
// that's likely to succeed on a retry, so don't bother adding it back
164165
// to the changedFilePaths set.
165166
void extLogger.log(
166-
`${this.name} failed while processing path: ${path}`,
167+
`${
168+
this.name
169+
} failed while processing path "${path}": ${getErrorMessage(e)}`,
167170
);
168171
}
169172
}

extensions/ql-vscode/test/vscode-tests/minimal-workspace/common/vscode/file-path-discovery.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
1212
import * as tmp from "tmp";
1313
import { normalizePath } from "../../../../../src/pure/files";
1414
import { extLogger } from "../../../../../src/common/logging/vscode/loggers";
15+
import { getErrorMessage } from "../../../../../src/pure/helpers-pure";
1516

1617
interface TestData {
1718
path: string;
@@ -385,10 +386,10 @@ describe("FilePathDiscovery", () => {
385386
);
386387

387388
expect(logSpy).toHaveBeenCalledWith(
388-
`TestFilePathDiscovery failed while processing path: ${join(
389+
`TestFilePathDiscovery failed while processing path "${join(
389390
workspacePath,
390391
"123.test",
391-
)}`,
392+
)}": ${getErrorMessage(new Error("error"))}`,
392393
);
393394
});
394395
});

0 commit comments

Comments
 (0)