Skip to content

Commit cca08ee

Browse files
committed
fix: Do not show directory read errors
1 parent fe28717 commit cca08ee

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/adapters/fileSystem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type FileSystem = {
22
fileExists: (filePath: string) => Promise<boolean>;
3-
readFile: (filePath: string) => Promise<Error | string>;
4-
writeFile: (filePath: string, contents: string) => Promise<Error | undefined>;
3+
readFile: (filePath: string) => Promise<NodeJS.ErrnoException | string>;
4+
writeFile: (filePath: string, contents: string) => Promise<NodeJS.ErrnoException | undefined>;
55
};

src/converters/comments/convertFileComments.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ export const convertFileComments = async (
1616
) => {
1717
const fileContent = await dependencies.fileSystem.readFile(filePath);
1818
if (fileContent instanceof Error) {
19-
return fileContent;
19+
if (fileContent.code === "EISDIR") {
20+
return undefined;
21+
} else {
22+
return fileContent;
23+
}
2024
}
2125

2226
const comments = parseFileComments(filePath, fileContent);

0 commit comments

Comments
 (0)