Search code examples
javascriptgoogle-chromesafarigoogle-chrome-devtoolssafari-web-inspector

how to break on error in Javascript


Is there a simple way to set a breakpoint one line before an error in the native browser debuggers such as Chrome and Safari? If not, what tools are there that will accomplish this task?


Solution

  • Open developer tools in Chrome and go to Sources tab. At the right hand side where you'll find the controls to step through your code you can click on the pause button once and it will turn blue. Now when an error happens it will pause your code at that line.

    enter image description here