зеркало из https://github.com/Azure/AzureRMR.git
more informative errors
This commit is contained in:
Родитель
182b7c0c5b
Коммит
d8634895ef
1
NEWS.md
1
NEWS.md
|
@ -2,6 +2,7 @@
|
|||
|
||||
- Expose `do_operation` methods for subscription and resource group objects, similar to that for resources. This allows arbitrary operations on a sub or RG.
|
||||
- Update default Resource Manager API version to "2019-08-01".
|
||||
- Provide more informative error messages, especially when a template deployment fails.
|
||||
|
||||
# AzureRMR 2.2.0
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ public=list(
|
|||
subscription=NULL,
|
||||
id=NULL,
|
||||
name=NULL,
|
||||
type=NULL,
|
||||
location=NULL,
|
||||
managed_by=NULL,
|
||||
properties=NULL,
|
||||
|
@ -150,6 +151,7 @@ public=list(
|
|||
else private$init(name, parms)
|
||||
|
||||
self$id <- parms$id
|
||||
self$type <- parms$type
|
||||
self$location <- parms$location
|
||||
self$managed_by <- parms$managedBy
|
||||
self$properties <- parms$properties
|
||||
|
|
|
@ -246,7 +246,16 @@ private=list(
|
|||
}
|
||||
if(status == "Succeeded")
|
||||
message("\nDeployment successful")
|
||||
else stop("\nUnable to deploy template", call.=FALSE)
|
||||
else
|
||||
{
|
||||
err_details <- parms$properties$error$details
|
||||
if(is.list(err_details))
|
||||
{
|
||||
msgs <- lapply(err_details, function(x) error_message(jsonlite::fromJSON(x$message)))
|
||||
stop("\nUnable to deploy template. Message:\n", do.call(paste0, msgs))
|
||||
}
|
||||
else stop("\nUnable to deploy template", call.=FALSE)
|
||||
}
|
||||
}
|
||||
parms
|
||||
},
|
||||
|
|
|
@ -106,14 +106,7 @@ error_message <- function(cont)
|
|||
msg <- if(is.character(cont))
|
||||
cont
|
||||
else if(is.list(cont))
|
||||
{
|
||||
if(is.character(cont$message))
|
||||
cont$message
|
||||
else if(is.list(cont$error) && is.character(cont$error$message))
|
||||
cont$error$message
|
||||
else if(is.list(cont$odata.error)) # OData
|
||||
cont$odata.error$message$value
|
||||
}
|
||||
as.character(unlist(cont))
|
||||
else ""
|
||||
|
||||
paste0(strwrap(msg), collapse="\n")
|
||||
|
|
Загрузка…
Ссылка в новой задаче