Jelajahi Sumber

优化错误提示

flyzto 1 hari lalu
induk
melakukan
7252632925
2 mengubah file dengan 16 tambahan dan 2 penghapusan
  1. 2 1
      pinnacle/libs/pinnacleClient.js
  2. 14 1
      pinnacle/main.js

+ 2 - 1
pinnacle/libs/pinnacleClient.js

@@ -66,7 +66,8 @@ export const pinnacleGet = async (url, params, channel) => {
     params
   }, channel)
   .catch(err => {
-    const source = { url, params };
+    const { username } = getAccountInfo() ?? {};
+    const source = { url, params, username };
     if (err?.response?.data) {
       const data = err.response.data;
       Object.assign(source, { data });

+ 14 - 1
pinnacle/main.js

@@ -760,7 +760,20 @@ const pinnacleDataLoop = () => {
       GLOBAL_DATA.loopActive = false;
 
       Logs.out('loop inactive');
-      notifyException(`Pinnacle API paused. ${exceptionMessage}. ${err.message}`);
+      const exceptionList = ['Pinnacle API paused']
+      if (exceptionMessage) {
+        exceptionList.push(exceptionMessage);
+      }
+      if (err.source?.data?.message) {
+        exceptionList.push(err.source.data.message);
+      }
+      else if (err.message) {
+        exceptionList.push(err.message);
+      }
+      if (err.source?.username) {
+        exceptionList.push(err.source.username);
+      }
+      notifyException(exceptionList.join('. '));
     }
   })
   .finally(() => {