소스 검색

优化错误提示

flyzto 1 일 전
부모
커밋
7252632925
2개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  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(() => {