Skip to content

Commit

Permalink
fix(ng-dev): properly catch errors for finding the ng-dev token in th…
Browse files Browse the repository at this point in the history
…e filesystem (#767)

Run the stat call inside of a try catch so that it properly fails as null

PR Close #767
  • Loading branch information
josephperrott committed Aug 11, 2022
1 parent 1c22264 commit c2cdc26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ng-dev/auth/shared/ng-dev-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ async function saveTokenToFileSystem(data: NgDevUserWithToken) {

/** Retrieve the token from the file system. */
async function retrieveTokenFromFileSystem(): Promise<NgDevUserWithToken | null> {
if (!(await stat(tokenPath))) {
try {
if (!(await stat(tokenPath))) {
return null;
}
} catch {
return null;
}

Expand Down

0 comments on commit c2cdc26

Please sign in to comment.