April 20th, 2011
When something goes wrong, you open the Web Inspector console (
Printing stack traces
Printing log messages to the Web Inspector console is also very helpful in understanding how your application behaves. Now you can make the log entries even more informative by including associated stack traces. There are several ways of doing that.
- You can instrument your code with
console.assert()with the error condition as the first parameter. Whenever this expression evaluates to false you will see a corresponding console record
Handling exceptions at runtime using window.onerror
Note that for more information on the recent features of the Web Inspector, you can visit the Chrome DevTools documentation page.