diff --git a/R/call_azure_sm.R b/R/call_azure_rm.R similarity index 89% rename from R/call_azure_sm.R rename to R/call_azure_rm.R index dc14e72..3e97948 100644 --- a/R/call_azure_sm.R +++ b/R/call_azure_rm.R @@ -35,13 +35,21 @@ call_azure_rm <- function(token, subscription, operation, ..., if(catch != "pass") { catch <- get(paste0(catch, "_for_status"), getNamespace("httr")) - catch(res) + catch(res, arm_error_message(res)) httr::content(res) } else res } +arm_error_message <- function(response) +{ + cont <- httr::content(response) + msg <- paste0(strwrap(cont$error$message), collapse="\n") + paste0("complete Resource Manager operation. Message:\n", msg) +} + + # TRUE for NULL and length-0 objects is_empty <- function(x) { @@ -70,3 +78,4 @@ named_list <- function(lst, name_field="name") } lst } +