From b37132174e5c9f88ceb6472b6f5e5ea58aba9adb Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Thu, 11 Aug 2022 14:54:11 +0000 Subject: [PATCH] fix(ng-dev): properly catch errors for finding the ng-dev token in the filesystem Run the stat call inside of a try catch so that it properly fails as null --- ng-dev/auth/shared/ng-dev-token.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ng-dev/auth/shared/ng-dev-token.ts b/ng-dev/auth/shared/ng-dev-token.ts index 0958af13c..aa5513d4e 100644 --- a/ng-dev/auth/shared/ng-dev-token.ts +++ b/ng-dev/auth/shared/ng-dev-token.ts @@ -106,7 +106,11 @@ async function saveTokenToFileSystem(data: NgDevUserWithToken) { /** Retrieve the token from the file system. */ async function retrieveTokenFromFileSystem(): Promise { - if (!(await stat(tokenPath))) { + try { + if (!(await stat(tokenPath))) { + return null; + } + } catch { return null; }