Bugtracker: Make error reporting optional, disable by default.

This commit is contained in:
Krytarik Raido
2020-06-07 21:13:04 +02:00
parent cd4cd70afa
commit cafa17ea1c
3 changed files with 14 additions and 8 deletions

View File

@ -429,9 +429,8 @@ class Bugtracker(callbacks.PluginRegexp):
if self.registryValue('replyWhenNotFound'):
irc.error("Could not find %s bug %d" % (tracker.description, bugid))
except BugtrackerError as e:
if not sure_bug and bugid < 30:
return
irc.error(str(e))
if self.registryValue('replyWhenError') and sure_bug:
irc.error(str(e))
else:
if report:
irc.reply(report)
@ -457,11 +456,12 @@ class Bugtracker(callbacks.PluginRegexp):
return
report = self.get_bug(channel or msg.nick, tracker, 'url', bugid, self.registryValue('showassignee', channel),
self.registryValue('extended', channel), do_url=False)
except BugtrackerError as e:
irc.error(str(e))
except BugNotFoundError:
if self.registryValue('replyWhenNotFound'):
irc.error("Could not find %s bug %s" % (tracker.description, match.group('bug')))
except BugtrackerError as e:
if self.registryValue('replyWhenError'):
irc.error(str(e))
else:
if report:
irc.reply(report)
@ -692,9 +692,9 @@ class Bugzilla(IBugtracker):
bug_n = zilladom.getElementsByTagName('bug')[0]
if bug_n.hasAttribute('error'):
errtxt = bug_n.getAttribute('error')
if errtxt == 'NotFound':
if errtxt in ('NotFound', 'InvalidBugId'):
raise BugNotFoundError
s = 'Error getting %s bug #%d: %s' % (self.description, bugid, errtxt)
s = 'Could not get %s bug #%d: %s' % (self.description, bugid, errtxt)
raise BugtrackerError(s)
try:
title = _getnodetxt(bug_n.getElementsByTagName('short_desc')[0])