Skip to content

WebLink doesn't handle missing attributes well #258

@idg10

Description

@idg10

The WebLink class in the Menes client has various properties of this form:

public string? Hreflang => this.source.GetProperty(HreflangProperty).GetString();

I believe the intention here is to return null when this property is not present. In fact the call to GetProperty throws a KeyNotFoundException.

I think all of these need to change to something like this:

public string? Hreflang => this.source.TryGetProperty(HreflangProperty, out JsonElement property) ? property.GetString() : null;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions