mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Changed privmsgs.getArgs to raise ArgumentError, and make the necessary changes in callbacks to Do The Right Thing
This commit is contained in:
parent
df77cfaccf
commit
46f3012f9a
@ -150,6 +150,9 @@ class Error(Exception):
|
||||
"""Generic class for errors in Privmsg callbacks."""
|
||||
pass
|
||||
|
||||
class ArgumentError(Error):
|
||||
pass
|
||||
|
||||
class Tokenizer:
|
||||
quotes = '"`'
|
||||
nonbacktickquotes = '"'
|
||||
@ -237,11 +240,10 @@ class IrcObjectProxy:
|
||||
else:
|
||||
command = getattr(callback, name)
|
||||
callback.callCommand(command, self, self.msg, self.args)
|
||||
except ArgumentError:
|
||||
self.reply(self.msg, command.__doc__.splitlines()[0])
|
||||
except Error, e:
|
||||
if str(e) == '':
|
||||
self.reply(self.msg, command.__doc__.splitlines()[0])
|
||||
else:
|
||||
self.reply(self.msg, debug.exnToString(e))
|
||||
self.reply(self.msg, debug.exnToString(e))
|
||||
except Exception, e:
|
||||
debug.recoverableException()
|
||||
self.reply(self.msg, debug.exnToString(e))
|
||||
|
@ -69,7 +69,7 @@ def getArgs(args, needed=1, optional=0):
|
||||
let the caller handle sending the help message.
|
||||
"""
|
||||
if len(args) < needed:
|
||||
raise callbacks.Error
|
||||
raise callbacks.ArgumentError
|
||||
if len(args) < needed + optional:
|
||||
ret = list(args) + ([''] * (needed + optional - len(args)))
|
||||
elif len(args) >= needed + optional:
|
||||
|
Loading…
Reference in New Issue
Block a user