Exemplo n.º 1
0
 internal InnerError(InnerErrorCodeValue code, string message, IReadOnlyDictionary <string, string> details, string target, InnerError innererror)
 {
     Code       = code;
     Message    = message;
     Details    = details;
     Target     = target;
     Innererror = innererror;
 }
Exemplo n.º 2
0
 internal TextAnalyticsError(ErrorCodeValue code, string message, string target, InnerError innererror, IReadOnlyList <TextAnalyticsError> details)
 {
     Code       = code;
     Message    = message;
     Target     = target;
     Innererror = innererror;
     Details    = details;
 }
Exemplo n.º 3
0
        internal static TextAnalyticsError DeserializeTextAnalyticsError(JsonElement element)
        {
            ErrorCodeValue        code       = default;
            string                message    = default;
            Optional <string>     target     = default;
            Optional <InnerError> innererror = default;
            Optional <IReadOnlyList <TextAnalyticsError> > details = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("code"))
                {
                    code = new ErrorCodeValue(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("message"))
                {
                    message = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("target"))
                {
                    target = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("innererror"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    innererror = InnerError.DeserializeInnerError(property.Value);
                    continue;
                }
                if (property.NameEquals("details"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TextAnalyticsError> array = new List <TextAnalyticsError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DeserializeTextAnalyticsError(item));
                    }
                    details = array;
                    continue;
                }
            }
            return(new TextAnalyticsError(code, message, target.Value, innererror.Value, Optional.ToList(details)));
        }