Last active
April 8, 2016 05:56
-
-
Save TracerLee/5fecbc767a6145c3721da0679ddac85f to your computer and use it in GitHub Desktop.
window.onerror
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 从全局捕获错误 | |
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