From 66ed34b66406f5b824af56c4e7e5fb0a1e440b63 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 18 Dec 2024 18:19:17 +0100 Subject: [PATCH] =?UTF-8?q?refactor(StringExtensions):=20Fehlermeldungen?= =?UTF-8?q?=20wurden=20ausgearbeitet=20und=20der=20falsche=20Variablenname?= =?UTF-8?q?=20=E2=80=9Emode=E2=80=9C=20wurde=20in=20=E2=80=9Edivisor?= =?UTF-8?q?=E2=80=9C=20umbenannt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Config/StringExtensions.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/DigitalData.Core.Security/Config/StringExtensions.cs b/DigitalData.Core.Security/Config/StringExtensions.cs index 889075f..111dfbb 100644 --- a/DigitalData.Core.Security/Config/StringExtensions.cs +++ b/DigitalData.Core.Security/Config/StringExtensions.cs @@ -37,20 +37,20 @@ var subStrings = format.Split("//"); if (subStrings.Length != 2) - throw new ArgumentException("Format is invalid. It must contain exactly one '//' separator."); + throw new ArgumentException($"Date tag format {format} is invalid. It must contain exactly one '//' separator.", nameof(format)); var formattedLeft = date.ToString(subStrings[0]); if (!int.TryParse(formattedLeft, out var dateValue)) - throw new FormatException("The left-side value of the format could not be parsed to an integer."); + throw new FormatException($"The left-side value ({formattedLeft}) of the format could not be parsed to an integer."); - if (!int.TryParse(subStrings[1], out var mode)) - throw new FormatException("The right-side value of the format could not be parsed to an integer."); + if (!int.TryParse(subStrings[1], out var divisor)) + throw new FormatException($"The right-side value ({divisor}) of the format could not be parsed to an integer."); - if (mode == 0) - throw new DivideByZeroException("Division by zero is not allowed."); + if (divisor == 0) + throw new DivideByZeroException($"Date tag format {format} includes division by zero, which is not allowed."); - var result = (dateValue - 1) / mode + 1; + var result = (dateValue - 1) / divisor + 1; return result.ToString(); }