Skip to content

Commit

Permalink
fix bugs in gen_table
Browse files Browse the repository at this point in the history
  • Loading branch information
yannikbuhl committed Aug 11, 2024
1 parent b6b4f42 commit 6fcc843
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/gen_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ gen_table_ <- function(name,
#-----------------------------------------------------------------------------
# Data download

if(database == "zensus"){
if (database == "zensus"){

response <- gen_zensus_api("data/tablefile",
name = name,
Expand Down
14 changes: 11 additions & 3 deletions R/utils_httr2.R
Original file line number Diff line number Diff line change
Expand Up @@ -276,21 +276,29 @@ return_table_object <- function(response,
"Consider making a range of smaller requests or use the \n",
"option to create a job by setting the 'job' parameter \n",
"of 'gen_table()' to TRUE. You can then download the job \n",
"later (use the function 'gen_list_jobs()' to check its status).")
"later (use the function 'gen_list_jobs()' to check its status) \n",
"and download it using gen_download_job().")

stop(error_message, call. = FALSE)

} else if (response_parsed$Status$Code == 99) {

message <- paste0("You have requested successfully created a job with \n",
message <- paste0("You have successfully created a job with \n",
"your request. Use the function 'gen_list_jobs()' ",
"to check its status and download it once completed.")

message(message)

} else if (response_parsed$Status$Code == 104) {

stop("There are no results for your request. Please check if the requested table code is valid for the database selected.",
call. = FALSE)

} else {

stop("There has been an error with your request (not parseable response type 'application/json').\n Please try again later or contact the package maintainer.",
stop(paste0("There has been an error with your request (API error code: '",
response_parsed$Status$Code,
"').\n Please try again later or contact the package maintainer."),
call. = FALSE)

}
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ In a short overview, there are functions divided in two main parts, searching fo

#### Other functions
- **gen_logincheck()**: Perform a logincheck to test your credentials
- **gen_qualitysigns()**: Get a list of quality signs (special characters) found in the API's tables
- **gen_signs()**: Get a list of quality signs (special characters) found in the API's tables
- **gen_update_evas()**: Manually scrape a newer version of the EVAS numbers (official statistic IDs)

### Caching
Expand Down

0 comments on commit 6fcc843

Please sign in to comment.