diff --git a/R/get_eurostat_json.R b/R/get_eurostat_json.R index 893627f9..eb76ca34 100755 --- a/R/get_eurostat_json.R +++ b/R/get_eurostat_json.R @@ -60,16 +60,17 @@ get_eurostat_json <- function(id, filters = NULL, status <- httr::status_code(resp) # check status and get json + msg <- ". Some datasets are not accessible via the eurostat interface. You can try to search the data manually from the comext database at http://epp.eurostat.ec.europa.eu/newxtweb/ or bulk download facility at http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing or annual Excel files http://ec.europa.eu/eurostat/web/prodcom/data/excel-files-nace-rev.2" if (status == 200){ jdat <- jsonlite::fromJSON(url) } else if (status == 400){ stop("Failure to get data. Probably invalid dataset id. Status code: ", - status) + status, msg) } else if (status == 500){ stop("Failure to get data. Probably filters did not return any data - or data exceeded query size limitation. Status code: ", status) + or data exceeded query size limitation. Status code: ", status, msg) } else { - stop("Failure to get data. Status code: ", status) + stop("Failure to get data. Status code: ", status, msg) } # get json data diff --git a/R/get_eurostat_raw.R b/R/get_eurostat_raw.R index 620ecc35..fa30ce64 100755 --- a/R/get_eurostat_raw.R +++ b/R/get_eurostat_raw.R @@ -35,11 +35,14 @@ get_eurostat_raw <- function(id) { col_types = readr::cols(.default = readr::col_character())) # check validity + if (ncol(dat) < 2 | nrow(dat) < 1) { + msg <- ". Some datasets are not accessible via the eurostat interface. You can try to search the data manually from the comext database at http://epp.eurostat.ec.europa.eu/newxtweb/ or bulk download facility at http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing or annual Excel files http://ec.europa.eu/eurostat/web/prodcom/data/excel-files-nace-rev.2" if (grepl("does not exist or is not readable", dat[1])) { - stop(id, " does not exist or is not readable") + + stop(id, " does not exist or is not readable", msg) } else { - stop(paste("Could not download ", id)) + stop(paste("Could not download ", id, msg)) } } diff --git a/docs/articles/blogposts.html b/docs/articles/blogposts.html index 765e1d5f..c42155e3 100755 --- a/docs/articles/blogposts.html +++ b/docs/articles/blogposts.html @@ -83,7 +83,7 @@