Skip to content

Commit

Permalink
Also don't throw on int parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Nov 18, 2024
1 parent 5ba739f commit 69ef260
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/LexBoxApi/Services/HgService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ private string[] GetWsList(System.Xml.XmlElement root, string tagName)
try
{
var json = JsonDocument.Parse(text);
return json.RootElement.GetProperty("modelversion").GetInt32();
if (json.RootElement.GetProperty("modelversion").TryGetInt32(out int version)) return version;
_logger.LogError("Invalid model version in GetModelVersionOfFlexProject, should be a number but got {modelversion}", json.RootElement.GetProperty("modelversion").ToString());
return null;
}
catch (JsonException e)
{
Expand Down

0 comments on commit 69ef260

Please sign in to comment.