July 2023
Intermediate to advanced
276 pages
6h 55m
English
Before we dive into code we need to step back and think about handling errors. We’ll discuss an example application here and use that to drive the discussions on error handling in the rest of this chapter.
Suppose we’re asked to write a program to print the names of the airports given a list of IATA codes. The happy path is simple to visualize—given the list, map it to the names, and print. But there are a few things that could go wrong in the process. We may run into a network error when accessing the details from a remote web service that provides the mapping of IATA codes to airport names. It’s also possible that one or more of the given IATA codes are not valid or not recognized by the web service. ...
Read now
Unlock full access