public static CloudException CreateFormattedException(this CloudException cloudException)
 {
     return(new CloudException(
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.FormattedCloudExceptionMessageTemplate,
                    cloudException.Response.StatusCode,
                    cloudException.Error.Code,
                    cloudException.Error.Message,
                    cloudException.GetRequestId(),
                    DateTime.UtcNow)));
 }
        public static CloudException CreateFormattedException(this CloudException cloudException)
        {
            JObject errorResponse = JObject.Parse(cloudException.Response.Content);

            return(new CloudException(
                       string.Format(
                           CultureInfo.InvariantCulture,
                           Resources.FormattedCloudExceptionMessageTemplate,
                           cloudException.Response.StatusCode,
                           cloudException.Body == null ? errorResponse["code"] : cloudException.Body.Code,
                           cloudException.Body == null ? errorResponse["message"] : cloudException.Body.Message,
                           cloudException.GetRequestId(),
                           DateTime.UtcNow)));
        }