|
|
|
@ -11,40 +11,43 @@ export class ErrorMonitoring
|
|
|
|
|
{
|
|
|
|
|
reportError(e.reason.stack);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function reportError(stack: any)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
console.log(stack);
|
|
|
|
|
await postData("http://192.168.1.251:25100/monitoring", {
|
|
|
|
|
stack,
|
|
|
|
|
href: window.location.href,
|
|
|
|
|
path: window.location.pathname
|
|
|
|
|
});
|
|
|
|
|
console.log("上报成功");
|
|
|
|
|
}
|
|
|
|
|
catch (error)
|
|
|
|
|
{
|
|
|
|
|
console.log("上报失败", error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
export async function reportError(stack: any)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (window.location.hostname !== "t.qcad.cc")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
function postData(url: RequestInfo, data: {})
|
|
|
|
|
{
|
|
|
|
|
return fetch(url, {
|
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
|
cache: 'no-cache',
|
|
|
|
|
credentials: 'same-origin',
|
|
|
|
|
headers: {
|
|
|
|
|
'user-agent': 'Mozilla/4.0 MDN Example',
|
|
|
|
|
'content-type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
method: 'POST',
|
|
|
|
|
mode: 'cors',
|
|
|
|
|
redirect: 'follow',
|
|
|
|
|
referrer: 'no-referrer',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log(stack);
|
|
|
|
|
await postData("http://192.168.1.251:25100/monitoring", {
|
|
|
|
|
stack,
|
|
|
|
|
href: window.location.href,
|
|
|
|
|
path: window.location.pathname
|
|
|
|
|
});
|
|
|
|
|
console.log("上报成功");
|
|
|
|
|
}
|
|
|
|
|
catch (error)
|
|
|
|
|
{
|
|
|
|
|
console.log("上报失败", error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function postData(url: RequestInfo, data: {})
|
|
|
|
|
{
|
|
|
|
|
return fetch(url, {
|
|
|
|
|
body: JSON.stringify(data),
|
|
|
|
|
cache: 'no-cache',
|
|
|
|
|
credentials: 'same-origin',
|
|
|
|
|
headers: {
|
|
|
|
|
'user-agent': 'Mozilla/4.0 MDN Example',
|
|
|
|
|
'content-type': 'application/json'
|
|
|
|
|
},
|
|
|
|
|
method: 'POST',
|
|
|
|
|
mode: 'cors',
|
|
|
|
|
redirect: 'follow',
|
|
|
|
|
referrer: 'no-referrer',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|