Added supybot.reply.detailedErrors.

This commit is contained in:
Jeremy Fincher 2004-01-20 22:26:48 +00:00
parent e88f2e5ba5
commit e8bba56f1f
2 changed files with 16 additions and 6 deletions

View File

@ -423,10 +423,10 @@ class IrcObjectProxy(RichReplyMethods):
self.error(str(e))
except Exception, e:
cb.log.exception('Uncaught exception:')
# TODO: Configuration variable for this detailed error. Users
# should be able to specify that a plain error message get
# returned.
self.error(utils.exnToString(e))
if conf.supybot.reply.detailedErrors():
self.error(utils.exnToString(e))
else:
self.replyError()
def finalEval(self):
assert not self.finalEvaled, 'finalEval called twice.'
@ -815,7 +815,10 @@ class PrivmsgRegexp(Privmsg):
# We catch exceptions here because IrcObjectProxy isn't doing our
# dirty work for us anymore.
self.log.exception('Uncaught exception from callCommand:')
irc.error(utils.exnToString(e))
if conf.supybot.reply.detailedErrors():
irc.error(utils.exnToString(e))
else:
irc.replyError()
def doPrivmsg(self, irc, msg):
if Privmsg.errored:
@ -863,7 +866,10 @@ class PrivmsgCommandAndRegexp(Privmsg):
except Exception, e:
if 'catchErrors' in kwargs and kwargs['catchErrors']:
self.log.exception('Uncaught exception in callCommand:')
irc.error(utils.exnToString(e))
if conf.supybot.reply.detailedErrors():
irc.error(utils.exnToString(e))
else:
irc.replyError()
else:
raise

View File

@ -163,6 +163,10 @@ the bot will send multi-message replies in a single messsage or in multiple
messages. For safety purposes (so the bot can't possibly flood) it will
normally send everything in a single message."""))
supybot.reply.register('detailedErrors', registry.Boolean(True, """Determines
whether error messages that result from bugs in the bot will show a detailed
error message (the uncaught exception) or a generic error message."""))
supybot.reply.register('errorInPrivate', registry.Boolean(False, """
Determines whether the bot will send error messages to users in private."""))