Merge branch 'PR-Branch' of https://github.com/libccy/noname into PR-Branch
This commit is contained in:
commit
07c38c5580
|
@ -861,7 +861,8 @@ async function setOnError() {
|
|||
}
|
||||
}
|
||||
//解析parsex里的content fun内容(通常是技能content)
|
||||
else if (err && err.stack && err.stack.split('\n')[1].trim().startsWith('at Object.eval [as 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))) {
|
||||
const codes = _status.event.content;
|
||||
if (typeof codes == 'function') {
|
||||
const lines = codes.toString().split("\n");
|
||||
|
|
|
@ -98,12 +98,12 @@ export class ChromePromiseErrorHandler {
|
|||
let fileName = void 0;
|
||||
|
||||
/**
|
||||
* @type {string | undefined}
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
let line = void 0;
|
||||
|
||||
/**
|
||||
* @type {string | undefined}
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
let column = void 0;
|
||||
|
||||
|
@ -119,8 +119,8 @@ export class ChromePromiseErrorHandler {
|
|||
const locationParts = extractLocation(location ? location[1] : formatedLine);
|
||||
|
||||
fileName = ['eval', '<anonymous>'].includes(locationParts[0]) ? void 0 : locationParts[0];
|
||||
line = locationParts[1];
|
||||
column = locationParts[2];
|
||||
line = Number(locationParts[1]);
|
||||
column = Number(locationParts[2]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,11 @@ export class ChromePromiseErrorHandler {
|
|||
// 反之我们只能不考虑报错文件信息,直接调用onerror
|
||||
else {
|
||||
// @ts-ignore
|
||||
window.onerror(error.message, void 0, void 0, void 0, error);
|
||||
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);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue