commit
5c2e0c7553
|
@ -864,7 +864,13 @@ async function setOnError() {
|
|||
}
|
||||
//解析parsex里的content fun内容(通常是技能content)
|
||||
// @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;
|
||||
if (typeof codes == 'function') {
|
||||
const lines = codes.toString().split("\n");
|
||||
|
|
|
@ -129,12 +129,16 @@ export class ChromePromiseErrorHandler {
|
|||
}
|
||||
// 反之我们只能不考虑报错文件信息,直接调用onerror
|
||||
else {
|
||||
// @ts-ignore
|
||||
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 column == 'string') column = Number(column);
|
||||
// @ts-ignore
|
||||
window.onerror(error.message, src, line, column, error);
|
||||
try{
|
||||
// @ts-ignore
|
||||
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 column == 'string') column = Number(column);
|
||||
// @ts-ignore
|
||||
window.onerror(error.message, src, line, column, error);
|
||||
}catch(e){
|
||||
window.onerror(error.message,'',0,0, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue