What is an unhandled exception?

An unhandled exception is an exception that propagates to the top of the call stack without any catch block, except clause, or rescue handler receiving it. What happens next depends on the runtime: a Node.js process exits, a browser tab logs to the console and abandons the current task, a request thread returns a 500.

The related case in JavaScript is an unhandled promise rejection, where a promise rejects and no .catch() or try/await is attached. These do not surface through window.onerror, so a codebase that only handles the first case misses the second.

Example

// Unhandled exception: nothing catches this
JSON.parse(responseBody);

// Unhandled promise rejection: no .catch(), no await in a try block
fetch('/api/invoices').then(r => r.json());

Neither call is in a try block, so neither error reaches your logs or your error tracker unless a top-level handler is listening for it.

What Rollbar does about unhandled exceptions

Rollbar’s browser SDK captures both cases through two configuration flags, captureUncaught and captureUnhandledRejections, so uncaught errors and rejected promises arrive as occurrences without per-call-site handling. Rollbar records each occurrence as a trace with an exception class, message, and stack trace, then groups it with the other occurrences of the same underlying condition. Rollbar assigns exceptions the level error by default and messages the level info.

Related terms

Catch uncaught errors with Rollbar.


Sources

See every term in the glossary

Build with confidence. Release with clarity.

Rollbar helps you track what breaks, understand why, and improve what comes next.

✓ 5K free events per month, forever
✓ 14-day full feature trial
✓ Easy and quick installation
Get started in minutes

Plans starting at $0. Take off with our 14-day full feature Free Trial.