What is the idiomatic way to process data through a number of functions, checking for errors after each function?

I think there is a disconnect or overloading of “error” to “exception”. OP’s python code just returns a map and doesn’t throw/raise. So there exists a universe of data processing functions where data can be considered invalid (or erroneous) by its form, and where no exception is thrown - but somehow the invalidity is captured in the intermediate results to preclude later processing. You could model this with try/catch and have all of your processing functions throw to signal invalidity and to stop processing (potentially stop everything). That is a bit different than the proffered example, although they aren’t far apart.

1 Like