Add additional hints to errors

This commit is contained in:
Peter Butzhammer
2024-02-09 11:18:48 +01:00
parent bfc9c93c80
commit 280a894b1f
2 changed files with 35 additions and 19 deletions

View File

@@ -102,15 +102,6 @@ public class Sharp7Plc : IPlc
});
}
private S7VariableAddress ParseAndVerify(string variableName, Type type)
{
var address = varaibleNameParser.Parse(variableName);
if (!address.MatchesType(type))
throw new DataTypeMissmatchException($"Address \"{variableName}\" does not match type {type}.", type, address);
return address;
}
public Task<TValue> GetValue<TValue>(string variableName)
{
return GetValue<TValue>(variableName, CancellationToken.None);
@@ -222,6 +213,15 @@ public class Sharp7Plc : IPlc
return Unit.Default;
}
private S7VariableAddress ParseAndVerify(string variableName, Type type)
{
var address = varaibleNameParser.Parse(variableName);
if (!address.MatchesType(type))
throw new DataTypeMissmatchException($"Address \"{variableName}\" does not match type {type}.", type, address);
return address;
}
private void PrintAndResetPerformanceStatistik()
{
if (performanceCoutner.Count == performanceCoutner.Capacity)