internal InnerError(InnerErrorCodeValue code, string message, IReadOnlyDictionary <string, string> details, string target, InnerError innerErrorValue) { Code = code; Message = message; Details = details; Target = target; InnerErrorValue = innerErrorValue; }
internal TextAnalyticsError(ErrorCodeValue code, string message, string target, InnerError innerError, IReadOnlyList <TextAnalyticsError> details) { Code = code; Message = message; Target = target; InnerError = innerError; Details = details; }
internal static TextAnalyticsError DeserializeTextAnalyticsError(JsonElement element) { ErrorCodeValue code = default; string message = default; string target = default; InnerError innerError = default; IReadOnlyList <TextAnalyticsError> details = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code")) { code = property.Value.GetString().ToErrorCodeValue(); continue; } if (property.NameEquals("message")) { message = property.Value.GetString(); continue; } if (property.NameEquals("target")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } target = property.Value.GetString(); continue; } if (property.NameEquals("innerError")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } innerError = InnerError.DeserializeInnerError(property.Value); continue; } if (property.NameEquals("details")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <TextAnalyticsError> array = new List <TextAnalyticsError>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(DeserializeTextAnalyticsError(item)); } } details = array; continue; } } return(new TextAnalyticsError(code, message, target, innerError, details)); }
internal static InnerError DeserializeInnerError(JsonElement element) { InnerErrorCodeValue code = default; string message = default; IReadOnlyDictionary <string, string> details = default; string target = default; InnerError innerError = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code")) { code = property.Value.GetString().ToInnerErrorCodeValue(); continue; } if (property.NameEquals("message")) { message = property.Value.GetString(); continue; } if (property.NameEquals("details")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property0.Name, null); } else { dictionary.Add(property0.Name, property0.Value.GetString()); } } details = dictionary; continue; } if (property.NameEquals("target")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } target = property.Value.GetString(); continue; } if (property.NameEquals("innerError")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } innerError = DeserializeInnerError(property.Value); continue; } } return(new InnerError(code, message, details, target, innerError)); }