mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
SedRegex: also catch errors in the regexp_wrapper() step
E.g. sre_constants.error: invalid group reference
From: e137d29eb9
This commit is contained in:
parent
5370296bbf
commit
6445e90ec7
@ -149,6 +149,7 @@ class SedRegex(callbacks.PluginRegexp):
|
||||
messageprefix = msg.nick
|
||||
else:
|
||||
messageprefix = '%s thinks %s' % (msg.nick, m.nick)
|
||||
try:
|
||||
if regexp_wrapper(text, pattern, timeout=0.05, plugin_name=self.name(),
|
||||
fcn_name='replacer'):
|
||||
if self.registryValue('boldReplacementText', msg.args[0]):
|
||||
@ -163,6 +164,10 @@ class SedRegex(callbacks.PluginRegexp):
|
||||
irc.reply(_("%s meant to say: %s") %
|
||||
(messageprefix, subst), prefixNick=False)
|
||||
return
|
||||
except (ValueError, re.error) as e:
|
||||
if self.registryValue('displayErrors', msg.args[0]):
|
||||
irc.error('%s.%s: %s' % (e.__class__.__module__, e.__class__.__name__, e))
|
||||
return
|
||||
|
||||
self.log.debug(_("SedRegex: Search %r not found in the last %i messages of %s."),
|
||||
msg.args[1], len(irc.state.history), msg.args[0])
|
||||
|
Loading…
Reference in New Issue
Block a user