瀏覽代碼

fix nodeCheckRemoteDesktop error handle

Michael Wang 3 年之前
父節點
當前提交
38fdf1fc12
共有 1 個文件被更改,包括 21 次插入6 次删除
  1. 21 6
      src/features/UserLogin/useRemoteAppChecker.ts

+ 21 - 6
src/features/UserLogin/useRemoteAppChecker.ts

@@ -47,13 +47,28 @@ export function useRemoteAppChecker() {
       return;
     }
 
-    const hasSun = nodeCheckRemoteDesktop();
-    if (hasSun) {
-      if (applicationNames) {
-        applicationNames += ",sunloginclient";
-      } else {
-        applicationNames = "sunloginclient";
+    try {
+      const hasSun = nodeCheckRemoteDesktop();
+      if (hasSun) {
+        if (applicationNames) {
+          applicationNames += ",sunloginclient";
+        } else {
+          applicationNames = "sunloginclient";
+        }
       }
+    } catch (error) {
+      logger({
+        cnl: ["local", "server"],
+        key: "nodeCheckRemoteDesktop",
+        pgu: "AUTO",
+        stk: error instanceof Error ? error.message : JSON.stringify(error),
+        dtl: "读取tasklist出错",
+        ext: { errorType: "e-01", applicationNames },
+      });
+      $message.error("系统检测出错(e-01),请退出程序后重试!", {
+        duration: 24 * 60 * 60 * 1000,
+      });
+      return;
     }
     if (!applicationNames?.trim()) {
       disableLoginBtnBecauseRemoteApp = false;