/// <summary> /// Tries to convert the given exception response to a <see cref="ManagementServiceExceptionInfo"/>. /// </summary> /// <param name="response">The response containing the xml serialized error information.</param> /// <param name="info">The converted <see cref="ManagementServiceExceptionInfo"/> containing errors from the exception.</param> /// <returns><c>true</c> if parsing succeeded.</returns> public static bool TryParse(System.Data.Services.Client.OperationResponse response, out ManagementServiceExceptionInfo info) { if (response != null && response.Error != null) { return(ManagementServiceExceptionInfo.TryParse(response.Error.Message, out info)); } info = default(ManagementServiceExceptionInfo); return(false); }
/// <summary> /// Converts the given exception response to a <see cref="ManagementServiceExceptionInfo"/>. /// </summary> /// <param name="response">The response containing the xml serialized error information.</param> /// <returns>The converted <see cref="ManagementServiceExceptionInfo"/> containing errors from the exception.</returns> public static ManagementServiceExceptionInfo Parse(System.Data.Services.Client.OperationResponse response) { if (response == null) { throw new ArgumentNullException("response"); } if (response.Error == null) { throw new ArgumentException(Resources.InvalidErrorInResponse, "response"); } ManagementServiceExceptionInfo info; if (ManagementServiceExceptionInfo.TryParse(response, out info)) { return(info); } else { throw new FormatException(Resources.InvalidExceptionMessageFormat); } }