Skip to content

Commit 30064fe

Browse files
benkeeniclanton
authored andcommitted
Update libraries/rush-lib/src/logic/pnpm/PnpmWorkspaceFile.ts
Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
1 parent 1ffabcd commit 30064fe

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

libraries/rush-lib/src/logic/pnpm/PnpmWorkspaceFile.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@ export class PnpmWorkspaceFile extends BaseWorkspaceFile {
6767
public static async loadCatalogsFromFileAsync(
6868
workspaceYamlFilename: string
6969
): Promise<Record<string, Record<string, string>> | undefined> {
70-
if (!(await FileSystem.existsAsync(workspaceYamlFilename))) {
71-
return undefined;
70+
let content: string;
71+
try {
72+
content = await FileSystem.readFileAsync(workspaceYamlFilename);
73+
} catch (error) {
74+
if (FileSystem.isNotExistError(error)) {
75+
return undefined;
76+
} else {
77+
throw error;
78+
}
7279
}
73-
const content: string = await FileSystem.readFileAsync(workspaceYamlFilename);
80+
7481
const parsed: IPnpmWorkspaceYaml | undefined = yamlModule.load(content) as IPnpmWorkspaceYaml | undefined;
7582

7683
return parsed?.catalogs;

0 commit comments

Comments
 (0)