예제 #1
0
        private static ApiErrorException ParseError(JsonReader jsonReader)
        {
            var error = new ApiErrorException();

            while (jsonReader.Read())
            {
                if (jsonReader.TokenType == JsonToken.PropertyName)
                {
                    switch ((string)jsonReader.Value)
                    {
                    case "message":
                        error.ErrorMessage = jsonReader.ReadAsString();
                        break;

                    case "stack":
                        error.ErrorStackTrace = jsonReader.ReadAsString();
                        break;

                    case "type":
                        error.ErrorType = jsonReader.ReadAsString();
                        break;

                    default:
                        jsonReader.Skip();
                        break;
                    }
                }
            }

            return(error);
        }
예제 #2
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);
        }
예제 #3
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;
        }
예제 #4
0
        private static ApiErrorException ParseError(JsonReader jsonReader)
        {
            var error = new ApiErrorException();

            while (jsonReader.Read())
            {
                if (jsonReader.TokenType == JsonToken.PropertyName)
                {
                    switch ((string)jsonReader.Value)
                    {
                        case "message":
                            error.ErrorMessage = jsonReader.ReadAsString();
                            break;

                        case "stack":
                            error.ErrorStackTrace = jsonReader.ReadAsString();
                            break;

                        case "type":
                            error.ErrorType = jsonReader.ReadAsString();
                            break;

                        default:
                            jsonReader.Skip();
                            break;
                    }
                }
            }

            return error;
        }