Пример #1
0
        internal DocumentError(string id, TextAnalyticsError error)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (error == null)
            {
                throw new ArgumentNullException(nameof(error));
            }

            Id    = id;
            Error = error;
        }
        internal static DocumentError DeserializeDocumentError(JsonElement element)
        {
            string             id    = default;
            TextAnalyticsError error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    error = TextAnalyticsError.DeserializeTextAnalyticsError(property.Value);
                    continue;
                }
            }
            return(new DocumentError(id, error));
        }