Course contentsShow
← Web Development
Lesson 2262 of 2,98241. Debugging TechniquesFree lesson

Exception Breakpoints

Configure DevTools to pause on caught or uncaught exceptions to debug errors at their source.

Exception Breakpoints

You'll learn how to make DevTools pause execution automatically whenever an error is thrown, catching bugs at their exact moment of failure.

What Are Exception Breakpoints?

Exception breakpoints tell DevTools to pause JavaScript execution when an exception (error) is thrown. This stops your code exactly where the problem occurs—before the error propagates up the call stack or gets swallowed by a catch block. Instead of reading cryptic error messages in the console after the fact, you pause mid-flight to inspect the exact state that caused the problem.

Two Types of Exception Breakpoints

Pause on caught exceptions: Stops execution even when an error is handled by a try...catch block. Useful when you suspect your error handling is masking a deeper issue.

Pause on uncaught exceptions: Only stops when an error isn't caught—when it would normally crash or log to the console. This is ideal for catching bugs that slip through without proper error handling.

How to Enable Them

In the Sources panel of Chrome DevTools, look for the "Pause on exceptions" icon (it looks like a stop sign with a pause symbol). Click it once to pause on uncaught exceptions. Click again to include caught exceptions too. The icon changes color when active.

Why This Matters

Think of exception breakpoints as a safety net that catches you mid-fall. Without them, you might see "TypeError: Cannot read property 'x' of undefined" in the console, but by then the context is gone. With exception breakpoints enabled, you pause at that exact line with all variables still in scope, ready to inspect in the Scope panel or hover over them.

Key Takeaway: Exception breakpoints pause execution when errors occur, letting you inspect the exact state that caused the problem—turn them on to debug errors at their source instead of chasing console messages.