From e9b122c97384da471d232a0939d1f4f6cc70bf71 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 31 Jan 2016 12:11:04 +0100 Subject: [PATCH] Later: Do not use ValueError for reporting full queues. Someone on IRC reported a ValueError being raised from an other part of the code. --- plugins/Later/plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/Later/plugin.py b/plugins/Later/plugin.py index 5474136dd..48bfaeee5 100644 --- a/plugins/Later/plugin.py +++ b/plugins/Later/plugin.py @@ -42,6 +42,9 @@ import supybot.callbacks as callbacks from supybot.i18n import PluginInternationalization, internationalizeDocstring _ = PluginInternationalization('Later') +class QueueIsFull(Exception): + pass + class Later(callbacks.Plugin): """Used to do things later; currently, it only allows the sending of nick-based notes. Do note (haha!) that these notes are *not* private @@ -93,7 +96,7 @@ class Later(callbacks.Plugin): try: notes = self._notes[nick] if maximum and len(notes) >= maximum: - raise ValueError + raise QueueIsFull() else: notes.append((at, whence, text)) except KeyError: @@ -170,7 +173,7 @@ class Later(callbacks.Plugin): for validnick in validnicks: try: self._addNote(validnick, msg.nick, text) - except ValueError: + except QueueIsFull: full_queues.append(validnick) if full_queues: irc.error(format(