mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Make irc.error do nothing is no string is given as argument.
Fixes c1d3bad64f
, which crashed with:
```
ERROR 2020-01-18T01:34:07 Uncaught exception in NickAuth._callCommand:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1337, in _callCommand
irc.errorNoCapability(cap)
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 544, in errorNoCapability
raise Error()
supybot.callbacks.Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/supybot/log.py", line 368, in m
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1359, in _callCommand
irc.error(str(e))
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1065, in error
raise ArgumentError
supybot.callbacks.ArgumentError
```
This commit is contained in:
parent
895881e66e
commit
32d8d141ad
@ -615,15 +615,13 @@ class ReplyIrcProxy(RichReplyMethods):
|
||||
|
||||
def error(self, s, msg=None, **kwargs):
|
||||
if 'Raise' in kwargs and kwargs['Raise']:
|
||||
if s:
|
||||
raise Error(s)
|
||||
else:
|
||||
raise ArgumentError
|
||||
raise Error()
|
||||
if msg is None:
|
||||
msg = self.msg
|
||||
m = _makeErrorReply(self, msg, s, **kwargs)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
if s:
|
||||
m = _makeErrorReply(self, msg, s, **kwargs)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
|
||||
def reply(self, s, msg=None, **kwargs):
|
||||
if msg is None:
|
||||
@ -1050,19 +1048,13 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
def error(self, s='', Raise=False, **kwargs):
|
||||
self.repliedTo = True
|
||||
if Raise:
|
||||
if s:
|
||||
raise Error(s)
|
||||
else:
|
||||
raise ArgumentError
|
||||
if s:
|
||||
if not isinstance(self.irc, irclib.Irc):
|
||||
return self.irc.error(s, **kwargs)
|
||||
else:
|
||||
m = _makeErrorReply(self, self.msg, s, **kwargs)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
else:
|
||||
raise ArgumentError
|
||||
raise Error(s)
|
||||
if not isinstance(self.irc, irclib.Irc):
|
||||
return self.irc.error(s, **kwargs)
|
||||
elif s:
|
||||
m = _makeErrorReply(self, self.msg, s, **kwargs)
|
||||
self.irc.queueMsg(m)
|
||||
return m
|
||||
|
||||
def __getattr__(self, attr):
|
||||
return getattr(self.irc, attr)
|
||||
|
@ -404,8 +404,8 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
finally:
|
||||
conf.supybot.reply.error.inPrivate.setValue(original)
|
||||
|
||||
def testErrorNoArgumentIsArgumentError(self):
|
||||
self.assertHelp('eval irc.error()')
|
||||
def testErrorNoArgumentIsSilent(self):
|
||||
self.assertResponse('eval irc.error()', 'None')
|
||||
|
||||
def testErrorWithNotice(self):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user