命令崩溃时也上报错误

pull/333/MERGE
ChenX 5 years ago
parent 3df879a469
commit 255d62b918

@ -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',
});
}

@ -1,7 +1,8 @@
import { app } from '../ApplicationServices/Application';
import { JigUtils } from './JigUtils';
import { CommandState } from './CommandState';
import { arrayRemoveOnce } from '../Common/ArrayExt';
import { reportError } from '../Common/ErrorMonitoring';
import { CommandState } from './CommandState';
import { JigUtils } from './JigUtils';
export interface Command
{
exec: Function;//函数可以返回true,实现放弃命令的任何操作.
@ -40,6 +41,7 @@ class CommandMachine
catch (error)
{
console.error(error.stack);
reportError(error.stack);
app.m_Editor.Prompt("抱歉,命令造成了错误,请联系开发人员.");
}
this.CommandEnd(abort);

Loading…
Cancel
Save