refactor(alarms): harden ExtractTagAlarm severity parse (TryGetInt32) + trim projector prior-state (review nits)
This commit is contained in:
@@ -666,7 +666,7 @@ public static class DeploymentArtifact
|
||||
var type = a.TryGetProperty("alarmType", out var tEl) && tEl.ValueKind == JsonValueKind.String
|
||||
? (tEl.GetString() ?? "AlarmCondition") : "AlarmCondition";
|
||||
var sev = a.TryGetProperty("severity", out var sEl) && sEl.ValueKind == JsonValueKind.Number
|
||||
? sEl.GetInt32() : 500;
|
||||
&& sEl.TryGetInt32(out var sv) ? sv : 500;
|
||||
return new EquipmentTagAlarmInfo(type, sev);
|
||||
}
|
||||
catch (JsonException) { return null; }
|
||||
|
||||
Reference in New Issue
Block a user