From f90ad5f9bec0eac8501333adec7ecfa0212ac9f2 Mon Sep 17 00:00:00 2001 From: Peter Butzhammer Date: Mon, 22 Jul 2024 14:18:03 +0200 Subject: [PATCH] Improve error message --- Sharp7.Rx/VariableNameParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sharp7.Rx/VariableNameParser.cs b/Sharp7.Rx/VariableNameParser.cs index 7191a48..3ffdb10 100644 --- a/Sharp7.Rx/VariableNameParser.cs +++ b/Sharp7.Rx/VariableNameParser.cs @@ -120,7 +120,7 @@ internal class VariableNameParser : IVariableNameParser { if (defaultValue.HasValue) return defaultValue.Value; - throw new InvalidS7AddressException($"Variable of type {type} must have a length set \"{input}\"", input); + throw new InvalidS7AddressException($"Variable of type {type} must have a length set. Example \"db12.byte10.3\", found \"{input}\"", input); } if (!ushort.TryParse(match.Groups["bitOrLength"].Value, out var result)) @@ -132,7 +132,7 @@ internal class VariableNameParser : IVariableNameParser byte GetBit() { if (!match.Groups["bitOrLength"].Success) - throw new InvalidS7AddressException($"Variable of type {type} must have a bit number set \"{input}\"", input); + throw new InvalidS7AddressException($"Variable of type {type} must have a bit number set. Example \"db12.bit10.3\", found \"{input}\"", input); if (!byte.TryParse(match.Groups["bitOrLength"].Value, out var result)) throw new InvalidS7AddressException($"\"{match.Groups["bitOrLength"].Value}\" is an invalid bit number in \"{input}\"", input);