public virtual IList <ResourceApiOperationParameterErrorResponse> GetErrorResponses(ApiDescription apiDescription) { var result = new List <ResourceApiOperationParameterErrorResponse>(); var memberNode = GetMemberNode(apiDescription.ActionDescriptor); if (memberNode != null) { var navigator = memberNode.Select("exception"); foreach (XPathNavigator n in navigator) { var errorResponse = new ResourceApiOperationParameterErrorResponse(); errorResponse.Code = n.GetAttribute("code", ""); errorResponse.Reason = n.GetAttribute("message", ""); if (String.IsNullOrEmpty(errorResponse.Reason)) { errorResponse.Reason = n.GetAttribute("reason", ""); } if (String.IsNullOrEmpty(errorResponse.Reason)) { errorResponse.Reason = n.InnerXml; } XPathNavigator attNavigator = n.Clone(); attNavigator.MoveToFirstAttribute(); while (attNavigator.MoveToNextAttribute()) { errorResponse.ExtraAttributes.Add(attNavigator.Name, attNavigator.Value); } if (ResourcesConfiguration.IsErrorMessageMapped(apiDescription, errorResponse)) { result.Add(errorResponse); } } } return(result); }
public virtual IList<ResourceApiOperationParameterErrorResponse> GetErrorResponses(ApiDescription apiDescription) { var result = new List<ResourceApiOperationParameterErrorResponse>(); var memberNode = GetMemberNode(apiDescription.ActionDescriptor); if (memberNode != null) { var navigator = memberNode.Select("exception"); foreach (XPathNavigator n in navigator) { var errorResponse = new ResourceApiOperationParameterErrorResponse(); errorResponse.Code = n.GetAttribute("code", ""); errorResponse.Reason = n.GetAttribute("message", ""); if (String.IsNullOrEmpty(errorResponse.Reason)) { errorResponse.Reason = n.GetAttribute("reason", ""); } if (String.IsNullOrEmpty(errorResponse.Reason)) { errorResponse.Reason = n.InnerXml; } XPathNavigator attNavigator = n.Clone(); attNavigator.MoveToFirstAttribute(); while (attNavigator.MoveToNextAttribute()) { errorResponse.ExtraAttributes.Add(attNavigator.Name, attNavigator.Value); } if (ResourcesConfiguration.IsErrorMessageMapped(apiDescription, errorResponse)) { result.Add(errorResponse); } } } return result; }