Search code examples
javascriptgoogle-chrome-devtools

What does pause on caught exceptions?


As I understand, the pause on exeptions allows us to stop the execution of the code before the error appears in the console. And ... maybe I haven't still seen the convenience of this tool. But in my opinion, when the error appears in the console, this is also pretty good - you can see the line where this error was made and also you can go into your code and see your error firsthand. Moreover, the code doesn't usually execute after an error anyway. It just stops (with or without this pause).

enter image description here

But if something is more or less clear with the pause on exeptions, then what pause on caught exeptions does I can't get. What is this pause on caught exceptions?


Solution

  • "Pause on exceptions" has two possible states (represented by the checkbox under it):

    • Pause only on exceptions that aren't caught (checkbox not ticked)
    • Pause on both exceptions that aren't caught and ones that are (checkbox ticked)

    The utility is that execution stops when the exception is raised, which lets you look at exactly where it was raised, the current values of variables that are in-scope in that location, etc.; and lets you see the UI as it is at that moment. Just seeing an error in the console later doesn't let you look around with the execution paused.