3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

coreplugin: catch NotAuthenticatedError in a prettier way

This commit is contained in:
James Lu 2015-09-02 23:37:54 -07:00
parent fe0156551a
commit 2c4a88b9be

View File

@ -32,10 +32,11 @@ def handle_commands(irc, source, command, args):
for func in world.bot_commands[cmd]:
try:
func(irc, source, cmd_args)
except utils.NotAuthenticatedError:
utils.msg(irc, source, 'Error: You are not authorized to perform this operation.')
except Exception as e:
log.exception('Unhandled exception caught in command %r', cmd)
utils.msg(irc, source, 'Uncaught exception in command %r: %s: %s' % (cmd, type(e).__name__, str(e)))
return
utils.add_hook(handle_commands, 'PRIVMSG')
# Handle WHOIS queries, for IRCds that send them across servers (charybdis, UnrealIRCd; NOT InspIRCd).