报错增加兜底
This commit is contained in:
parent
ff8670cf3b
commit
b30604de95
|
@ -864,7 +864,13 @@ async function setOnError() {
|
||||||
}
|
}
|
||||||
//解析parsex里的content fun内容(通常是技能content)
|
//解析parsex里的content fun内容(通常是技能content)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
else if (err && err.stack && ['at Object.eval [as content]', 'at Proxy.content'].some(str => err.stack.split('\n')[1].trim().startsWith(str))) {
|
else if (err && err.stack && ['at Object.eval [as content]', 'at Proxy.content'].some(str =>{
|
||||||
|
let stackSplit1 = err.stack.split('\n')[1];
|
||||||
|
if(stackSplit1){
|
||||||
|
return stackSplit1.trim().startsWith(str);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})) {
|
||||||
const codes = _status.event.content;
|
const codes = _status.event.content;
|
||||||
if (typeof codes == 'function') {
|
if (typeof codes == 'function') {
|
||||||
const lines = codes.toString().split("\n");
|
const lines = codes.toString().split("\n");
|
||||||
|
|
|
@ -129,12 +129,16 @@ export class ChromePromiseErrorHandler {
|
||||||
}
|
}
|
||||||
// 反之我们只能不考虑报错文件信息,直接调用onerror
|
// 反之我们只能不考虑报错文件信息,直接调用onerror
|
||||||
else {
|
else {
|
||||||
|
try{
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let [_, src = void 0, line = void 0, column = void 0] = /at\s+.*\s+\((.*):(\d*):(\d*)\)/i.exec(error.stack.split('\n')[1])
|
let [_, src = void 0, line = void 0, column = void 0] = /at\s+.*\s+\((.*):(\d*):(\d*)\)/i.exec(error.stack.split('\n')[1])
|
||||||
if (typeof line == 'string') line = Number(line);
|
if (typeof line == 'string') line = Number(line);
|
||||||
if (typeof column == 'string') column = Number(column);
|
if (typeof column == 'string') column = Number(column);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.onerror(error.message, src, line, column, error);
|
window.onerror(error.message, src, line, column, error);
|
||||||
|
}catch(e){
|
||||||
|
window.onerror(error.message,'',0,0, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue