添加index.html中缺少的extractLocation函数
This commit is contained in:
parent
7001d91654
commit
28b4b0885b
13
index.html
13
index.html
|
@ -19,6 +19,19 @@
|
|||
};
|
||||
const STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
||||
const errorList = [];
|
||||
function extractLocation(urlLike) {
|
||||
// 不存在地址信息的字符串
|
||||
if (!/:/.test(urlLike)) {
|
||||
return [urlLike];
|
||||
}
|
||||
|
||||
// 捕获位置用到的正则
|
||||
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
||||
const parts = regExp.exec(urlLike.replace(/[()]/g, ''));
|
||||
|
||||
// @ts-ignore
|
||||
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
||||
}
|
||||
window.onunhandledrejection = async event => {
|
||||
event.promise.catch(error => {
|
||||
console.log(error);
|
||||
|
|
Loading…
Reference in New Issue