mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
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:
parent
ce0b788f2f
commit
e9b122c973
@ -42,6 +42,9 @@ import supybot.callbacks as callbacks
|
|||||||
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
||||||
_ = PluginInternationalization('Later')
|
_ = PluginInternationalization('Later')
|
||||||
|
|
||||||
|
class QueueIsFull(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
class Later(callbacks.Plugin):
|
class Later(callbacks.Plugin):
|
||||||
"""Used to do things later; currently, it only allows the sending of
|
"""Used to do things later; currently, it only allows the sending of
|
||||||
nick-based notes. Do note (haha!) that these notes are *not* private
|
nick-based notes. Do note (haha!) that these notes are *not* private
|
||||||
@ -93,7 +96,7 @@ class Later(callbacks.Plugin):
|
|||||||
try:
|
try:
|
||||||
notes = self._notes[nick]
|
notes = self._notes[nick]
|
||||||
if maximum and len(notes) >= maximum:
|
if maximum and len(notes) >= maximum:
|
||||||
raise ValueError
|
raise QueueIsFull()
|
||||||
else:
|
else:
|
||||||
notes.append((at, whence, text))
|
notes.append((at, whence, text))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -170,7 +173,7 @@ class Later(callbacks.Plugin):
|
|||||||
for validnick in validnicks:
|
for validnick in validnicks:
|
||||||
try:
|
try:
|
||||||
self._addNote(validnick, msg.nick, text)
|
self._addNote(validnick, msg.nick, text)
|
||||||
except ValueError:
|
except QueueIsFull:
|
||||||
full_queues.append(validnick)
|
full_queues.append(validnick)
|
||||||
if full_queues:
|
if full_queues:
|
||||||
irc.error(format(
|
irc.error(format(
|
||||||
|
Loading…
Reference in New Issue
Block a user