コード例 #1
0
        internal static ErrorResponse DeserializeErrorResponse(JsonElement element)
        {
            Optional <ErrorDefinition> error = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("error"))
                {
                    error = ErrorDefinition.DeserializeErrorDefinition(property.Value);
                    continue;
                }
            }
            return(new ErrorResponse(error.Value));
        }
コード例 #2
0
        internal static ErrorResponse DeserializeErrorResponse(JsonElement element)
        {
            Optional <ErrorDefinition> error = default;

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