예제 #1
0
        private PayloadErrorDetails GetErrorDetails(XmlNode root, XmlNamespaceManager manager)
        {
            PayloadErrorDetails details = null;

            if (root.HasChildNodes)
            {
                details = new PayloadErrorDetails();
                HttpStatusCode statusCode;
                var            node = root.SelectSingleNode("def:StatusCode", manager);
                if (node.IsNull() || !HttpStatusCode.TryParse(node.InnerText, out statusCode))
                {
                    throw new SerializationException("Unable to parse the Status Code of the Error Details.");
                }
                details.StatusCode = statusCode;
                node = root.SelectSingleNode("def:ErrorId", manager);
                if (node.IsNull())
                {
                    throw new SerializationException("Unable to parse the error id of the Error response component.");
                }
                details.ErrorId = node.InnerText;
                node            = root.SelectSingleNode("def:ErrorMessage", manager);
                if (node.IsNull())
                {
                    throw new SerializationException("Unable to parse the error message of the Error response component.");
                }
                details.ErrorMessage = node.InnerText;
            }
            return(details);
        }
예제 #2
0
 private PayloadErrorDetails GetErrorDetails(XmlNode root, XmlNamespaceManager manager)
 {
     PayloadErrorDetails details = null;
     if (root.HasChildNodes)
     {
         details = new PayloadErrorDetails();
         HttpStatusCode statusCode;
         var node = root.SelectSingleNode("def:StatusCode", manager);
         if (node.IsNull() || !HttpStatusCode.TryParse(node.InnerText, out statusCode))
         {
             throw new SerializationException("Unable to parse the Status Code of the Error Details.");
         }
         details.StatusCode = statusCode;
         node = root.SelectSingleNode("def:ErrorId", manager);
         if (node.IsNull())
         {
             throw new SerializationException("Unable to parse the error id of the Error response component.");
         }
         details.ErrorId = node.InnerText;
         node = root.SelectSingleNode("def:ErrorMessage", manager);
         if (node.IsNull())
         {
             throw new SerializationException("Unable to parse the error message of the Error response component.");
         }
         details.ErrorMessage = node.InnerText;
     }
     return details;
 }