Understanding the anatomy of an Observable contract
Understanding the anatomy of an Observable contract is crucial in order to learn error handling patterns. Let’s dig deep into the Observable execution timeline by exploring the marble diagram explained in Chapter 1, Diving into the Reactive Paradigm:
Figure 4.1 – The marble diagram elements
Let’s examine the previous diagram. If we take a look at the stream’s lifecycle, we can figure out that a stream has two final statuses:
- Completion status: Where the stream has ended without errors and will not emit any further values. It is a shutdown, i.e., the Observable completes.
- Error status: Where the stream has ended with an error and will not emit any further values after the error is thrown. It is also a shutdown.
Only one of those two states can occur, not both, and every stream can error out once. This is the Observable contract.
At this point, you may be...