[chore:] logging for AddressCreation.cs

This commit is contained in:
2026-05-16 15:09:32 +02:00
parent 2d33326bab
commit 5f79df55d2
+29 -1
View File
@@ -43,7 +43,8 @@ public static class AddressCreator
public static string? CreateFinalMarkdownString(int id)
{
// Maximum seven lines of information
try
{
// find the address
KasPerson? address = null;
var string_address = "";
@@ -197,9 +198,18 @@ public static class AddressCreator
if (address_line_count > 1) return string_address;
return null;
}
catch (Exception ex)
{
Logger.Log($"Error while creating markdown string: {ex.Message}", Logger.LogType.Error);
}
return null;
}
public static string CreateNameLine(string anredezus, string anrede, string titel, string vorname, string adel,
string name, string namezus)
{
try
{
if (!string.IsNullOrWhiteSpace(anredezus))
return string.Join(" ",
@@ -215,6 +225,14 @@ public static class AddressCreator
)
+ (string.IsNullOrWhiteSpace(namezus) ? "" : $" ({namezus.Trim()})");
}
catch (Exception ex)
{
Logger.Log($"Error while performing address name line creation: {ex.Message}", Logger.LogType.Error);
}
return null;
}
/// <summary>
/// Returns true if a plz (or pplz) is valid
@@ -223,6 +241,8 @@ public static class AddressCreator
/// <param name="land">country, to check the plz</param>
/// <returns>true or faslse, depending on result :+1:</returns>
public static bool CheckPLZ(string plz, string land)
{
try
{
if (string.IsNullOrWhiteSpace(plz)) return false;
@@ -249,4 +269,12 @@ public static class AddressCreator
// For non-German countries, accept any non-empty postal code
return true;
}
catch (Exception ex)
{
Logger.Log($"Error while performing address plz check: {ex.Message}", Logger.LogType.Error);
}
return false;
}
}