internal static ErrorResponse DeserializeErrorResponse(JsonElement element) { Optional <ErrorDetail> error = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("error")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } error = ErrorDetail.DeserializeErrorDetail(property.Value); continue; } } return(new ErrorResponse(error.Value)); }
internal ErrorResponse(ErrorDetail error) { Error = error; }