From 0103b6488407aecce50f952d0cf0d929096278af Mon Sep 17 00:00:00 2001 From: Andrew Gene Brown Date: Tue, 18 Jun 2024 15:35:25 -0700 Subject: [PATCH] SDA_query: handle possible POST request failure before checking response type --- R/SDA_query.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/SDA_query.R b/R/SDA_query.R index 74f33c7d..5f3ff862 100644 --- a/R/SDA_query.R +++ b/R/SDA_query.R @@ -160,6 +160,11 @@ SDA_query <- function(q, dsn = NULL) { encode = "form" ), silent = TRUE) + if (inherits(r, 'try-error')) { + message("Soil Data Access POST request failed, returning try-error.\n\n", r) + return(invisible(r)) + } + # check response content type h <- r$all_headers if (!is.null(h)) {