简体   繁体   中英

Are all errors shown in the Chrome console JavaScript errors?

Google Chrome, Firefox, and other browsers have a developer console to show errors. Are these the same errors that are triggered by window.onerror ?

The Chrome developer console is a superset of the information that is made available to window.onerror . The developer console will show JavaScript errors, security errors, CSS errors, deprecation warnings, and many other internal faults in rendering the document.

window.onerror is only unhandled global JavaScript errors.

Another important difference is that the Developer Console will show the real, original error information whereas window.onerror might obfuscate the error message to "Script Error" if the error violates the Same Origin Policy .

The Chrome Developer console is a better set of information during development. Once you release your app, you should continue to trap and record errors from window.onerror so that you can be sure to know when your users run into problems. The browser landscape is constantly changing, and you should know when something starts breaking. There are some good tools to help you do this automatically, like TrackJS . Disclosure: I am one of the founding developers of TrackJS, so I've fixed a lot of js errors :)

Unhandled javascript exceptions will raise the onerror event which you can handle.

If you handle an exception in a try { ... } catch (e) { ... } block, whether it logs to the console is browser and setting specific.

I am use firebug on FireFox,( You can use Break point, console.log(), errors,warnings,timeline,JS performance etc... ) I Suggestion you.

Chrome https://getfirebug.com/releases/lite/chrome/

Firefox https://addons.mozilla.org/en-us/firefox/addon/firebug/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM