internal ClusterErrorStatus DeserializeClusterError(XElement resource) { resource.ArgumentNotNull("resource"); var operationStatusElement = resource.Element(OperationStatusElementName); if (operationStatusElement == null) { return(null); } string errorMessage; ClusterErrorStatus clusterErrorStatus = null; var errorElement = operationStatusElement.Element(ErrorElementName); var extendedErrorElement = this.ExtractResourceOutputStringValue(resource, ExtendedErrorElementName); if (errorElement != null) { var errorType = this.GetStringValue(operationStatusElement, TypeElementName); var httpCode = int.Parse(this.GetStringValue(errorElement, HttpCodeElementName), CultureInfo.InvariantCulture); errorMessage = this.GetStringValue(errorElement, MessageElementName); clusterErrorStatus = new ClusterErrorStatus(httpCode, errorMessage, errorType); } if (extendedErrorElement.IsNotNullOrEmpty()) { if (clusterErrorStatus == null) { clusterErrorStatus = new ClusterErrorStatus(); } clusterErrorStatus.Message = extendedErrorElement; } return(clusterErrorStatus); }
internal ClusterErrorStatus DeserializeClusterError(XElement resource) { resource.ArgumentNotNull("resource"); var operationStatusElement = resource.Element(OperationStatusElementName); if (operationStatusElement == null) { return null; } string errorMessage; ClusterErrorStatus clusterErrorStatus = null; var errorElement = operationStatusElement.Element(ErrorElementName); var extendedErrorElement = this.ExtractResourceOutputStringValue(resource, ExtendedErrorElementName); if (errorElement != null) { var errorType = this.GetStringValue(operationStatusElement, TypeElementName); var httpCode = int.Parse(this.GetStringValue(errorElement, HttpCodeElementName), CultureInfo.InvariantCulture); errorMessage = this.GetStringValue(errorElement, MessageElementName); clusterErrorStatus = new ClusterErrorStatus(httpCode, errorMessage, errorType); } if (extendedErrorElement.IsNotNullOrEmpty()) { if (clusterErrorStatus == null) { clusterErrorStatus = new ClusterErrorStatus(); } clusterErrorStatus.Message = extendedErrorElement; } return clusterErrorStatus; }