liveBook · Manning

Global error handler

A global error handler is a runtime-level mechanism that receives or reports errors escaping local error-handling mechanisms.

How 2 Manning books explain it

JavaScript in Depth

A top-level error-catching mechanism that receives errors escaping local handlers in a runtime or platform.

How it is used
Serves as a last-resort reporting point for errors escaping local handlers, including errors from later callbacks.
How deep it goes
Explains call-stack escape and asynchronous disconnection, then contrasts browser and Node.js hooks; defers cross-boundary propagation to Promises and async/await.
Examples
Uses a timer callback that evades surrounding try-catch, a browser `error` listener, and a Node.js `uncaughtException` listener.
What you can do after
Diagnose/debug with it by reporting escaped errors while moving recovery decisions to handlers with operational context.

Read how JavaScript in Depth explains global error handler →

Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

The uncaughtException event is a Node.js process event emitted when an exception reaches the event loop without being caught.

How it is used
Handles unexpected Node.js errors in production microservices by logging them and choosing continuation or process termination.
How deep it goes
Explains event handling, standard-error logging, exit codes, and restart consequences, but does not detail recovery procedures.
Examples
Uses process.on listings that either log an uncaught exception or log it before exiting with code 1.
What you can do after
Operate/configure a Node.js service to report uncaught exceptions and deliberately resume or terminate with an error status.

Read how Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform explains global error handler →

Also covered in

What to know first

Related concepts

Questions about global error handler

What is global error handler?

A global error handler is a runtime-level mechanism that receives or reports errors escaping local error-handling mechanisms.

Which Manning books explain global error handler?

JavaScript in Depth and Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform.

What should I know before learning global error handler?

Manning books that teach global error handler usually introduce promise first.

What is the difference between global error handler and catch block?

A global error handler is a runtime-level mechanism that receives or reports errors escaping local error-handling mechanisms. A catch block is a language construct that associates a handler with protected code and transfers control to it when an exception or error is raised.

What is global error handler a kind of?

Global error handler is a kind of handler. A handler is a software routine or component invoked to process an event, request, message, or other input.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.