|
@@ -1,7 +1,16 @@
|
|
|
import Vue from "vue";
|
|
|
|
|
|
Vue.config.errorHandler = error => {
|
|
|
- window._hmt.push(["_trackEvent", "Vue组件错误", error.stack]);
|
|
|
+ // Vue.prototype.$httpNoAuth.post(
|
|
|
+ // "/api/ecs_core/log/studentClient/" + "debug/007001",
|
|
|
+ // error.stack.replace(/\n/g, '||||'),
|
|
|
+ // {
|
|
|
+ // headers: {
|
|
|
+ // "Content-Type": "text/plain"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ window._hmt.push(["_trackEvent", "Vue组件错误"]);
|
|
|
throw error;
|
|
|
};
|
|
|
|
|
@@ -18,47 +27,59 @@ Vue.config.errorHandler = error => {
|
|
|
// };
|
|
|
|
|
|
window.addEventListener("error", function(event) {
|
|
|
- window._hmt.push([
|
|
|
- "_trackEvent",
|
|
|
- "全局JS错误",
|
|
|
- event.message,
|
|
|
- `source: ${event.filename}\nlineno: ${event.lineno}\ncolno: ${
|
|
|
- event.colno
|
|
|
- }\nerror: ${event.error.stack}`
|
|
|
- ]);
|
|
|
+ // Vue.prototype.$httpNoAuth.post(
|
|
|
+ // "/api/ecs_core/log/studentClient/" + "debug/007002",
|
|
|
+ // `message: ${event.message}\nsource: ${event.filename}\nlineno: ${event.lineno}\ncolno: ${
|
|
|
+ // event.colno
|
|
|
+ // }\nerror: ${event.error.stack}`.replace(/\n/g, '||||'),
|
|
|
+ // {
|
|
|
+ // headers: {
|
|
|
+ // "Content-Type": "text/plain"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ window._hmt.push(["_trackEvent", "全局JS错误", event.message]);
|
|
|
});
|
|
|
|
|
|
window.addEventListener("unhandledrejection", function(event) {
|
|
|
- let detail = "";
|
|
|
- if (event.reason.config) {
|
|
|
- detail += "url:" + event.reason.config.url + "\n";
|
|
|
- detail += "data: " + event.reason.config.data + "\n";
|
|
|
- if (event.reason.request && event.reason.request.response) {
|
|
|
- detail += "response: " + event.reason.request.response + "\n";
|
|
|
- }
|
|
|
- }
|
|
|
- window._hmt.push([
|
|
|
- "_trackEvent",
|
|
|
- "全局Promise未处理错误",
|
|
|
- event.reason,
|
|
|
- detail
|
|
|
- ]);
|
|
|
+ // let detail = "";
|
|
|
+ // if (event.reason.config) {
|
|
|
+ // detail += "url:" + event.reason.config.url + "\n";
|
|
|
+ // detail += "data: " + event.reason.config.data + "\n";
|
|
|
+ // if (event.reason.request && event.reason.request.response) {
|
|
|
+ // detail += "response: " + event.reason.request.response + "\n";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // Vue.prototype.$httpNoAuth.post(
|
|
|
+ // "/api/ecs_core/log/studentClient/" + "debug/007003",
|
|
|
+ // `reason: ${event.reason}\ndetail: ${detail}`.replace(/\n/g, '||||'),
|
|
|
+ // {
|
|
|
+ // headers: {
|
|
|
+ // "Content-Type": "text/plain"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ window._hmt.push(["_trackEvent", "全局Promise未处理错误", event.reason]);
|
|
|
});
|
|
|
|
|
|
window.addEventListener("rejectionhandled", function(event) {
|
|
|
console.log("rejectionhandled"); // 似乎并不触发
|
|
|
- let detail = "";
|
|
|
- if (event.reason.config) {
|
|
|
- detail += "url:" + event.reason.config.url + "\n";
|
|
|
- detail += "data: " + event.reason.config.data + "\n";
|
|
|
- if (event.reason.request && event.reason.request.response) {
|
|
|
- detail += "response: " + event.reason.request.response + "\n";
|
|
|
- }
|
|
|
- }
|
|
|
- window._hmt.push([
|
|
|
- "_trackEvent",
|
|
|
- "全局Promise已处理错误",
|
|
|
- event.reason,
|
|
|
- detail
|
|
|
- ]);
|
|
|
+ // let detail = "";
|
|
|
+ // if (event.reason.config) {
|
|
|
+ // detail += "url:" + event.reason.config.url + "\n";
|
|
|
+ // detail += "data: " + event.reason.config.data + "\n";
|
|
|
+ // if (event.reason.request && event.reason.request.response) {
|
|
|
+ // detail += "response: " + event.reason.request.response + "\n";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // Vue.prototype.$httpNoAuth.post(
|
|
|
+ // "/api/ecs_core/log/studentClient/" + "debug/007004",
|
|
|
+ // `reason: ${event.reason}\ndetail: ${detail}`.replace(/\n/g, '||||'),
|
|
|
+ // {
|
|
|
+ // headers: {
|
|
|
+ // "Content-Type": "text/plain"
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ window._hmt.push(["_trackEvent", "全局Promise已处理错误", event.reason]);
|
|
|
});
|