mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
Added check for key to Clear command
If the key was wrong or wasn't in the group, a `KeyNotFoundException` was thrown. Also added acknowledgment of a successful deletion
This commit is contained in:
parent
840fb21e15
commit
a9fce3237c
1 changed files with 15 additions and 1 deletions
|
|
@ -36,12 +36,26 @@ namespace PepperDash.Essentials.Core
|
|||
/// <param name="groupName"></param>
|
||||
static void ClearEventsFromGroup(string groupName)
|
||||
{
|
||||
if (!EventGroups.ContainsKey(groupName))
|
||||
{
|
||||
Debug.Console(0,
|
||||
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||
groupName);
|
||||
return
|
||||
}
|
||||
|
||||
var group = EventGroups[groupName];
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
group.ClearAllEvents();
|
||||
|
||||
Debug.Console(0, "[Scheduler]: All events deleted from group '{0}'", groupName);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.", groupName);
|
||||
Debug.Console(0,
|
||||
"[Scheduler]: Unable to delete events from group '{0}'. Group not found in EventGroups dictionary.",
|
||||
groupName);
|
||||
}
|
||||
|
||||
static void ListAllEventGroups(string command)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue