3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

changehost: more friendly error when an expansion field is unavailable

This commit is contained in:
James Lu 2016-08-02 23:04:09 -07:00
parent 1cda5023c8
commit a6258dd973

View File

@ -55,7 +55,11 @@ def _changehost(irc, target, args):
# you're careful with what you're doing, and that is why this # you're careful with what you're doing, and that is why this
# hidden option exists. -GLolol # hidden option exists. -GLolol
new_host = template.substitute(args) try:
new_host = template.substitute(args)
except KeyError as e:
log.warning('(%s) Bad expansion %s in template %s' % (irc.name, e, host_template))
continue
# Replace characters that are not allowed in hosts with "-". # Replace characters that are not allowed in hosts with "-".
for char in new_host: for char in new_host: