Skip to content

Commit 9a7bfad

Browse files
authored
Cleanup: Remove log on missing .swift-version file (#1701)
* Cleanup: Remove log on missing .swift-version file In most cases this file won't exist, and that is OK. Omit the log pollution that prints the error when the .swift-version file can't be found.
1 parent c89821a commit 9a7bfad

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/PackageWatcher.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,13 @@ export class PackageWatcher {
154154
const contents = await fs.readFile(versionFile);
155155
return Version.fromString(contents.toString().trim());
156156
} catch (error) {
157-
this.workspaceContext.outputChannel.appendLine(
158-
`Failed to read .swift-version file at ${versionFile}: ${error}`
159-
);
160-
return undefined;
157+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
158+
this.workspaceContext.outputChannel.appendLine(
159+
`Failed to read .swift-version file at ${versionFile}: ${error}`
160+
);
161+
}
161162
}
163+
return undefined;
162164
}
163165

164166
/**

0 commit comments

Comments
 (0)