Skip to content

Commit

Permalink
Add simple error handling for 404
Browse files Browse the repository at this point in the history
Should be made more robust
  • Loading branch information
aleksanderbl29 committed Nov 28, 2024
1 parent 8cb79e5 commit c8004be
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) != 200) {
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) {
stop(httr::content(dst_data, encoding = "UTF-8")$message)
}

Expand Down

0 comments on commit c8004be

Please sign in to comment.