Skip to content
jshacks.dev
Debugging

Break on all exceptions including caught ones

Stop at the line where an error is thrown, even when a try/catch swallows it, using Pause on caught exceptions in Chrome DevTools.

1 min read
Summarize in AI

An error is thrown, caught by a try/catch that ignores it, and the page misbehaves with nothing in the console. Pausing on exceptions shows the original throw.

load.jsJavaScript
function loadSettings() {
  try {
    return JSON.parse(localStorage.getItem("settings"));
  } catch {
    console.log("recovered");
    return {};
  }
}

If the stored value is not valid JSON, the code logs recovered and moves on, so the console shows only that:

Text
recovered

In the Sources panel, click the Pause on exceptions button, tick Pause on caught exceptions, and reload. DevTools now stops at the JSON.parse line with the SyntaxError available in scope, and the call stack leads back to the caller. Details are in the DevTools pause guide.

The option catches every handled exception in the page, including those thrown by libraries as part of their normal control flow, so it can stop often. Turn it on when needed and off after, or add a condition in the call stack to ignore library files by blackboxing them.

In Node.js DevTools and VS Code, the same option is available under breakpoints as "Caught Exceptions".

Share

More snippets

Debugging

Group related logs with console.group

Indent related console output under a label with console.group and console.groupEnd, so interleaved logs from one request stay readable in Node.js 24.

1 min read
Debugging

Inspect an object with console.dir

Show nested objects beyond the default depth of two with console.dir and the depth option, instead of the [Object] placeholders console.log prints.

1 min read
Debugging

Debug a single Vitest test in VS Code

Run one Vitest file under the VS Code debugger with a launch configuration that passes the open file, so breakpoints in tests and source work. Vitest 3.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.