Explorar o código

记录全局JS错误的详细信息

Michael Wang %!s(int64=6) %!d(string=hai) anos
pai
achega
e5949b9b5a
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      src/utils/monitors.js

+ 6 - 1
src/utils/monitors.js

@@ -38,7 +38,12 @@ window.addEventListener("error", function(event) {
   //     }
   //   }
   // );
-  window._hmt.push(["_trackEvent", "全局JS错误", event.message]);
+  window._hmt.push([
+    "_trackEvent",
+    "全局JS错误",
+    event.message,
+    event.error.stack.replace(/\n/g, "||||")
+  ]);
 });
 
 window.addEventListener("unhandledrejection", function(event) {