internal InnerError(string code, string message, string errorDetail, InnerError innerErrorValue) { Code = code; Message = message; ErrorDetail = errorDetail; InnerErrorValue = innerErrorValue; }
internal Error(string code, string message, string target, IReadOnlyList <Error> details, InnerError innererror, DateTimeOffset?occurredDateTime) { Code = code; Message = message; Target = target; Details = details; Innererror = innererror; OccurredDateTime = occurredDateTime; }
internal static Error DeserializeError(JsonElement element) { string code = default; string message = default; Optional <string> target = default; Optional <IReadOnlyList <Error> > details = default; Optional <InnerError> innererror = default; Optional <DateTimeOffset> occurredDateTime = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code")) { code = 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("details")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <Error> array = new List <Error>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DeserializeError(item)); } details = array; continue; } if (property.NameEquals("innererror")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } innererror = InnerError.DeserializeInnerError(property.Value); continue; } if (property.NameEquals("occurredDateTime")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } occurredDateTime = property.Value.GetDateTimeOffset("O"); continue; } } return(new Error(code, message, target.Value, Optional.ToList(details), innererror.Value, Optional.ToNullable(occurredDateTime))); }