From c148d2a3b1ad5bc98a18f841e58ceb01948ec63f Mon Sep 17 00:00:00 2001 From: "BERTHET Clement (Externe)" Date: Mon, 18 Mar 2024 16:50:17 +0100 Subject: [PATCH] api_put() update to return server description + exception message --- R/API-methods.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/API-methods.R b/R/API-methods.R index 36ade82f..3af92dac 100644 --- a/R/API-methods.R +++ b/R/API-methods.R @@ -132,7 +132,13 @@ api_put <- function(opts, endpoint, ..., default_endpoint = "v1/studies") { config, ... ) - stop_for_status(result) + api_content <- content(result) + if(!is.null(names(api_content))) + api_content <- paste0("\n[Description] : ", api_content$description, + "\n[Exception] : ", api_content$exception) + else + api_content <- NULL + stop_for_status(result, task = api_content) content(result) }