Dealing with It Downstream
Ideally, the operations we perform in the functional pipeline are pure operations with no side-effects. The data flows in harmony as it gets transformed from one stage of the functional pipeline to the next. In reality, things go wrong, Murphy’s law intervenes, and we have to gracefully deal with the messes we may run into.
A good strategy to deal with errors and exceptions in functional programming is to treat an error as a form of data, move it down the pipeline, and deal with it downstream.
Wrap the Exception Received into an Object
|Treat errors and exceptions as forms of data. Wrap the details in an object and ...|