internal static ErrorResponse DeserializeErrorResponse(JsonElement element)
        {
            Optional <ErrorBody> error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    error = ErrorBody.DeserializeErrorBody(property.Value);
                    continue;
                }
            }
            return(new ErrorResponse(error.Value));
        }
Esempio n. 2
0
        internal static ErrorResponse DeserializeErrorResponse(JsonElement element)
        {
            Optional <ErrorBody> error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = ErrorBody.DeserializeErrorBody(property.Value);
                    continue;
                }
            }
            return(new ErrorResponse(error.Value));
        }