January 2020
Intermediate to advanced
532 pages
13h 31m
English
The most obvious places to wrap a try-catch block are in the code blocks that we need to acquire network resources, for example, querying a database or connecting to a web server. Whenever the network is involved, there is a much higher chance of encountering an issue than doing something locally on the same computer.
It is important to understand what kind of errors can be thrown. Suppose that we continue developing the web crawler use case from the previous section. The index_sites! function is now implemented using the HTTP library as follows:
function index_site!(site::Target) response = HTTP.get(site.url) site.finished = true site.finish_time = now() println("Site $(site.url) crawled. Status=", ...Read now
Unlock full access