Hi, could someone get me started making my program more fault-tolerant? Specifically I have a script that makes about 75 API calls and gathers the results. Sometimes, for various reasons, the API call doesn't work, returning various html error codes. How can I detect when this happens, perhaps make a note of it, and continue the program?
I'm attaching a typical example below. In this case it is the "fredr" function that makes the API request. Thank you!
Chicago Fed National Activity Index: Diffusion Index
raw <- fredr(
series_id = "CFNAIDIFF")
sbp_CFNAIDIFF <- raw %>%
transmute(date, date_type = "M",
var = "CFNAIDIFF", val = value)
if (do_remove_used) remove(raw)
l1 <- bind_rows(l1, sbp_CFNAIDIFF)