Later: Do not use ValueError for reporting full queues.

Someone on IRC reported a ValueError being raised from an other part of the code.
This commit is contained in:
Valentin Lorentz 2016-01-31 12:11:04 +01:00
parent ce0b788f2f
commit e9b122c973
1 changed files with 5 additions and 2 deletions

View File

@ -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(