Last active
August 31, 2015 03:27
-
-
Save think2011/ea8fa678948a71814d88 to your computer and use it in GitHub Desktop.
从全局捕获错误
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
/** | |
* 从全局捕获错误 | |
* @param errMsg | |
* @param scriptURI | |
* @param lineNumber | |
* @param columnNumber | |
* @param errorObj | |
* @return | |
*/ | |
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