[dotnet] [bidi] Implement browsing context download events by nvborisenko · Pull Request #16382 · SeleniumHQ/selenium
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Throw exception on unknown discriminatorIn the public override DownloadEndEventArgs? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- return reader.GetDiscriminator("status") switch
+ var discriminator = reader.GetDiscriminator("status");
+ return discriminator switch
{
"canceled" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<DownloadCanceledEventArgs>()),
"complete" => JsonSerializer.Deserialize(ref reader, options.GetTypeInfo<DownloadCompleteEventArgs>()),
- _ => null,
+ _ => throw new JsonException($"Unknown 'status' discriminator '{discriminator}' for DownloadEndEventArgs."),
};
}
Suggestion importance[1-10]: 7__ Why: The suggestion correctly identifies that returning | Medium |
| ||