diff --git a/index.html b/index.html index 22e37375f..26ccba872 100755 --- a/index.html +++ b/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);