Chapter 11. Error handling and recovery

 

This chapter covers

  • Reacting to errors
  • Properly freeing resources
  • Dealing with backpressure

Errors happen; that’s a fact of programming life. To provide high-quality service to the users of your applications, you must make sure your code handles errors and gracefully recovers when they happen. Otherwise, users experience application crashes or incorrect behavior (such as wrong computations or unexpected alerts) that can eventually turn them away from your product. In the case of an error, you might want to swallow it and continue, or add specific handling for a specific error. If an observable periodically emits updates from a central server, and one of the updates causes an unexpected error (for example, a network disconnection), handling the error by resubscribing observers to get the next set of updates might be the best solution. This chapter teaches you about the kinds of error-handling operators you can use to ensure that your observable pipeline is protected.

11.1. Reacting to errors

11.2. Controlling the lifetime of resources

11.3. Dealing with backpressure

11.4. Summary