feat: TimeZone getting an invalid time zone now throws exception with time zone name

This commit is contained in:
Drew Tingen
2022-06-23 15:05:45 -04:00
parent 0490ffd572
commit bb9bcf6cdf

View File

@@ -61,7 +61,11 @@ namespace ICD.Common.Utils.TimeZoneInfo
public static IcdTimeZoneInfo FindSystemTimeZoneById(string timeZoneId)
{
return s_Cache[timeZoneId];
IcdTimeZoneInfo timeZone;
if (s_Cache.TryGetValue(timeZoneId, out timeZone))
return timeZone;
throw new KeyNotFoundException(string.Format("Unable to find timezone with id:{0}", timeZoneId));
}
public static bool TryFindSystemTimeZoneById(string timeZoneId, out IcdTimeZoneInfo output)