Recently in the process of doing the project, found that many JS error did not pay attention, I wanted to capture the wanted JS error, and then show us on a platform
Specific implementation code:
window.onerror = function(message, url, lineNumber,columnNo,error) {
var data = {
'message':message,
'url':url,
'error':error.stack
};
$.ajax({
url:"/error/capture",
type:'post',
data:data,
success:function(){
}
});
return true;
};
Platform effect (you can visually see what the problem with a)
Original Address: Capture JS error log
Tags: window onerror Capture error
Intelligent Recommendation
- Custom mysql log apparmor cause problems
- To create a private DNS service
- Yii2 capture error log
- Nginx return keyword configuration tips
- Composer: php dependency management tool
Reproduced in: https: //my.oschina.net/54php/blog/687099