mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-12 21:22:36 +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,19 +149,24 @@ class SedRegex(callbacks.PluginRegexp):
|
|||||||
messageprefix = msg.nick
|
messageprefix = msg.nick
|
||||||
else:
|
else:
|
||||||
messageprefix = '%s thinks %s' % (msg.nick, m.nick)
|
messageprefix = '%s thinks %s' % (msg.nick, m.nick)
|
||||||
if regexp_wrapper(text, pattern, timeout=0.05, plugin_name=self.name(),
|
try:
|
||||||
fcn_name='replacer'):
|
if regexp_wrapper(text, pattern, timeout=0.05, plugin_name=self.name(),
|
||||||
if self.registryValue('boldReplacementText', msg.args[0]):
|
fcn_name='replacer'):
|
||||||
replacement = ircutils.bold(replacement)
|
if self.registryValue('boldReplacementText', msg.args[0]):
|
||||||
subst = process(pattern.sub, replacement,
|
replacement = ircutils.bold(replacement)
|
||||||
text, count, timeout=0.05)
|
subst = process(pattern.sub, replacement,
|
||||||
if action: # If the message was an ACTION, prepend the nick back.
|
text, count, timeout=0.05)
|
||||||
subst = '* %s %s' % (m.nick, subst)
|
if action: # If the message was an ACTION, prepend the nick back.
|
||||||
|
subst = '* %s %s' % (m.nick, subst)
|
||||||
|
|
||||||
subst = axe_spaces(subst)
|
subst = axe_spaces(subst)
|
||||||
|
|
||||||
irc.reply(_("%s meant to say: %s") %
|
irc.reply(_("%s meant to say: %s") %
|
||||||
(messageprefix, subst), prefixNick=False)
|
(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
|
return
|
||||||
|
|
||||||
self.log.debug(_("SedRegex: Search %r not found in the last %i messages of %s."),
|
self.log.debug(_("SedRegex: Search %r not found in the last %i messages of %s."),
|
||||||
|
Loading…
Reference in New Issue
Block a user