Example #1
0
        private static ApiErrorException ParseError(XmlReader xmlReader)
        {
            var error = new ApiErrorException();

            xmlReader.ReadToNextElement();

            while (!xmlReader.EOF)
            {
                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    switch (xmlReader.Name)
                    {
                        case "message":
                            error.ErrorMessage = xmlReader.ReadElementContentAsString();
                            break;

                        case "stack":
                            error.ErrorStackTrace = xmlReader.ReadElementContentAsString();
                            break;

                        case "type":
                            error.ErrorType = xmlReader.ReadElementContentAsString();
                            break;

                        default:
                            xmlReader.Skip();
                            break;
                    }
                }
                else
                {
                    xmlReader.Read();
                }
            }

            return error;
        }