Skip to content

Commit

Permalink
Add case for 404 when table is in registry
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderbl29 committed Nov 28, 2024
1 parent c8004be commit c52b30f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/dst_get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ dst_get_data <- function(table,
dst_data <- httr::GET(dst_url)

# Make sure the returned status is OK
if (httr::status_code(dst_data) == 404) {
if (httr::status_code(dst_data) == 404 && table %in% dkstat::tables$id) {
stop("The resource could not be reached.
Please submit an issue on https://github.com/rOpenGov/dkstat/issues")
} else if (httr::status_code(dst_data) == 404) {
stop("The resource you requested have not been found.
Please make sure that the table is in `tables`")
} else if (httr::status_code(dst_data) != 200) {
Expand Down

0 comments on commit c52b30f

Please sign in to comment.