Skip to content

Instantly share code, notes, and snippets.

@TracerLee
Last active April 8, 2016 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TracerLee/5fecbc767a6145c3721da0679ddac85f to your computer and use it in GitHub Desktop.
Save TracerLee/5fecbc767a6145c3721da0679ddac85f to your computer and use it in GitHub Desktop.
window.onerror
// 从全局捕获错误
window.onerror = function (errMsg, scriptURI, lineNumber, columnNumber, errorObj) {
setTimeout(function () {
var rst = {
"错误信息:": errMsg,
"出错文件:": scriptURI,
"出错行号:": lineNumber,
"出错列号:": columnNumber,
"错误详情:": errorObj
};
alert(JSON.stringify(rst, null, 10));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment