Catch callbacks.Error coming out of invalidCommand.

This commit is contained in:
Jeremy Fincher 2004-09-12 20:27:03 +00:00
parent 139ce9871c
commit 75e53d37f3

View File

@ -544,19 +544,18 @@ class IrcObjectProxy(RichReplyMethods):
for cb in self.irc.callbacks: for cb in self.irc.callbacks:
log.debug('Trying to call %s.invalidCommand.' % cb.name()) log.debug('Trying to call %s.invalidCommand.' % cb.name())
if hasattr(cb, 'invalidCommand'): if hasattr(cb, 'invalidCommand'):
try: self._callInvalidCommand(cb)
# I think I took out this try/except block because we if self.finished:
# firewalled invalidCommand, but we've no guarantee that log.debug('Finished calling invalidCommand: %s.',cb.name())
# other classes won't have firewalled it. Better safe return
# than sorry, I say.
cb.invalidCommand(self, self.msg, self.args) def _callInvalidCommand(self, cb):
if self.finished: try:
log.debug('Finished calling invalidCommand: %s.', cb.invalidCommand(self, self.msg, self.args)
cb.name()) except Error, e:
return self.error(str(e))
except Exception, e: except Exception, e:
log.exception('Uncaught exception in %s.invalidCommand', log.exception('Uncaught exception in %s.invalidCommand'% cb.name())
cb.name())
def _callCommand(self, name, cb): def _callCommand(self, name, cb):
try: try:
@ -864,8 +863,8 @@ class Privmsg(irclib.IrcCallback):
# that's wrong, because we can't do generic error handling in this # that's wrong, because we can't do generic error handling in this
# callCommand -- plugins need to be able to override callCommand and do # callCommand -- plugins need to be able to override callCommand and do
# error handling there (see the Http plugin for an example). # error handling there (see the Http plugin for an example).
__firewalled__ = {'isCommand': None, __firewalled__ = {'isCommand': None,}
'invalidCommand': None} # 'invalidCommand': None} # Gotta raise callbacks.Error.
public = True public = True
handled = False handled = False
errored = False errored = False