liveBook · Manning

Failure

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

An error is an abnormal condition or event that causes software to produce incorrect behavior or prevents it from completing an operation.

Failure is an abnormal condition that produces incorrect behavior or prevents an operation from completing. In a microservice, failures can come from runtime exceptions, invalid input, unexpected code combinations, or unavailable dependencies. Handling them deliberately reduces harm to users and the business. section 11.2.2

Build an error-handling strategy around the failure you can anticipate and the failure you cannot:

  • Handle anticipated failures with exceptions, callbacks, or promises; retry, correct and restart, report, or notify operations as appropriate. section 11.2.2
  • Choose whether unexpected failures should abort and restart the process or resume operation. section 11.2.2
  • Use an uncaught-exception handler to log diagnostic information, and exit when the process cannot safely continue. section 11.2.2

Unexpected exception

A microservice receives bad sensor data, encounters an unhandled runtime exception, or loses access to RabbitMQ or Azure Storage. Its strategy must determine whether to retry, notify, resume, or terminate and restart. section 11.2.2

Figure 11.3 Strategies for handling unexpected errors

Compare the abort-and-restart and resume-operation strategies for unexpected errors. section 11.2.2

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

How deep it goes
Defines failure sources and outlines retry, notification, abort-and-restart, and resume strategies without detailing every implementation path.
Examples
Uses runtime exceptions, faulty sensor or human input, RabbitMQ failure, Azure Storage failure, and uncaught-exception handlers.
What it assumes
Assumes JavaScript error-handling constructs and microservice context while emphasizing deliberate planning for unknown failures.
What you can do after
Diagnose/debug with logs and choose recovery actions for anticipated and unexpected microservice failures.
How it connects
Connects failure with exceptions, callbacks, promises, retries, microservices, and external dependencies.

Also explained in

Compare how 12 books explain failure →

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.