豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit c2cdc26

Browse files
committed
fix(ng-dev): properly catch errors for finding the ng-dev token in the filesystem (#767)
Run the stat call inside of a try catch so that it properly fails as null PR Close #767
1 parent 1c22264 commit c2cdc26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ng-dev/auth/shared/ng-dev-token.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ async function saveTokenToFileSystem(data: NgDevUserWithToken) {
106106

107107
/** Retrieve the token from the file system. */
108108
async function retrieveTokenFromFileSystem(): Promise<NgDevUserWithToken | null> {
109-
if (!(await stat(tokenPath))) {
109+
try {
110+
if (!(await stat(tokenPath))) {
111+
return null;
112+
}
113+
} catch {
110114
return null;
111115
}
112116

0 commit comments

Comments
 (0)