Skip to content

Commit 00cb9b2

Browse files
committed
Fix catalog leaf item serialization
1 parent c54bab1 commit 00cb9b2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/BaGet.Protocol/Converters/BaseCatalogLeafConverter.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ public override bool CanConvert(Type objectType)
2424

2525
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
2626
{
27-
string output;
28-
if (_fromType.TryGetValue((CatalogLeafType)value, out output))
27+
if (!_fromType.TryGetValue((CatalogLeafType)value, out var output))
2928
{
30-
writer.WriteValue(output);
29+
throw new NotSupportedException($"The catalog leaf type '{value}' is not supported.");
3130
}
3231

33-
throw new NotSupportedException($"The catalog leaf type '{value}' is not supported.");
32+
writer.WriteValue(output);
3433
}
3534
}
3635
}

0 commit comments

Comments
 (0)