liveBook · Manning

Resume

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

Resume operation is an error-handling strategy that allows a process to continue after an unexpected error.

Resume operation handles unexpected errors by keeping the process running instead of aborting it. In Node.js, registering an uncaughtException handler takes explicit control of that decision. section 11.2.2

A practical implementation must account for these consequences:

  • The process continues as best it can, but the error may have left it in a bad state. section 11.2.2
  • Print the error to standard error so production logging can collect it. section 11.2.2
  • Choose resume deliberately against abort-and-restart, which can delegate recovery to Kubernetes. section 11.2.2

Handle an uncaught exception

Register process.on("uncaughtException", err => { console.error("Uncaught exception:"); console.error(err && err.stack || err); }); to log the error and allow the process to continue.

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

How deep it goes
Explains the strategy, Node.js event handling, logging, and bad-state risk, but stops short of corrective recovery procedures.
Examples
Uses a process.on("uncaughtException", ...) handler that prints the exception message or stack trace.
What it assumes
Assumes familiarity with Node.js processes, uncaught exceptions, standard error, and production logging.
What you can do after
Operate Node.js processes by intercepting uncaught exceptions and forwarding diagnostic output to production logs.
How it connects
Connects uncaught exceptions, error handling, standard error, production logging, Kubernetes, and abort-and-restart.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.