Global javascript exception handler (in Chrome)

后端 未结 4 1850
暖寄归人
暖寄归人 2021-02-13 23:55

How do I overwrite the global Exception handler in javascript so that it becomes the top level handler for all uncaught exceptions?

EDIT: window.onerror didnt work, cod

4条回答
  •  无人及你
    2021-02-14 00:44

    window.onerror = function(errorMsg, url, lineNumber) {
        // code to run when error has occured on page
    }
    

提交回复
热议问题