示例#1
0
        internal DocumentError(string id, TextAnalyticsError_internal 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_internal error = default;

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