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_jp() - REST Countries APIget_japan_child_mortality() - World Bank APIget_japan_cpi() - World Bank APIget_japan_energy_use() - World Bank APIget_japan_gdp() - World Bank APIget_japan_holidays() - Nager.Date APIget_japan_hospital_beds() - World Bank APIget_japan_life_expectancy() - World Bank APIget_japan_literacy_rate() - World Bank APIget_japan_population() - World Bank APIget_japan_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 functionsJapanAPIs packageview_datasets_JapanAPIs() function to explore
available datasetsget_country_info_jp() - Retrieve key country
information about Japanget_japan_child_mortality() - Get under-5 mortality
rate dataget_japan_cpi() - Get Consumer Price Index dataget_japan_energy_use() - Get energy use per capita
dataget_japan_gdp() - Get GDP in current US dollarsget_japan_holidays() - Get official public holidays for
any yearget_japan_hospital_beds() - Get hospital beds per 1,000
peopleget_japan_life_expectancy() - Get life expectancy at
birthget_japan_literacy_rate() - Get adult literacy rate
(15+)get_japan_population() - Get total population dataget_japan_unemployment() - Get unemployment rate
dataview_datasets_JapanAPIs() - Interactive function to
explore and view available datasets