tryCatch() blocks for
network errors, HTTP errors, and JSON parsing errorsNULL with clear messages instead
of throwing errors when API calls fail\donttest{}
instead of if (interactive()) to prevent issues during
R CMD checkNULL when APIs are unavailableAll API-calling functions have been updated with improved error handling:
get_country_info_idn() - REST Countries APIget_indonesia_child_mortality() - World Bank APIget_indonesia_cpi() - World Bank APIget_indonesia_energy_use() - World Bank APIget_indonesia_gdp() - World Bank APIget_indonesia_holidays() - Nager.Date APIget_indonesia_hospital_beds() - World Bank APIget_indonesia_life_expectancy() - World Bank APIget_indonesia_literacy_rate() - World Bank APIget_indonesia_population() - World Bank APIget_indonesia_unemployment() - World Bank APIhttr::timeout(10)
parameterhttp_error() and http_status()
checks for robust HTTP error detectionstop() with
message() + return(NULL) pattern for graceful failures@importFrom declarations to include new error
handling functionsIndonesiAPIs packageview_datasets_IndonesiAPIs() function to explore
available datasetsget_country_info_idn() - Retrieve key country
information about Indonesiaget_indonesia_child_mortality() - Get under-5 mortality
rate dataget_indonesia_cpi() - Get Consumer Price Index
dataget_indonesia_energy_use() - Get energy use per capita
dataget_indonesia_gdp() - Get GDP in current US
dollarsget_indonesia_holidays() - Get official public holidays
for any yearget_indonesia_hospital_beds() - Get hospital beds per
1,000 peopleget_indonesia_life_expectancy() - Get life expectancy
at birthget_indonesia_literacy_rate() - Get adult literacy rate
(15+)get_indonesia_population() - Get total population
dataget_indonesia_unemployment() - Get unemployment rate
dataview_datasets_IndonesiAPIs() - Interactive function to
explore and view available datasets