From c8004be1bc262ef6a0c518e5face8e7158c91952 Mon Sep 17 00:00:00 2001 From: aleksanderbl29 <73799306+aleksanderbl29@users.noreply.github.com> Date: Thu, 28 Nov 2024 09:32:08 +0100 Subject: [PATCH] Add simple error handling for 404 Should be made more robust --- R/dst_get_data.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/dst_get_data.R b/R/dst_get_data.R index 0c5fe7a..2689ac1 100644 --- a/R/dst_get_data.R +++ b/R/dst_get_data.R @@ -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) }