3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 03:33:10 +01:00

automode: replace assert usage with proper exceptions

This commit is contained in:
James Lu 2018-01-22 08:17:20 -08:00
parent 09c8b03705
commit 28a62f629a

View File

@ -156,14 +156,16 @@ def _get_channel_pair(irc, source, chanpair, perm=None):
channel = '#' + channel
channel = irc.to_lower(channel)
assert irc.is_channel(channel), "Invalid channel name %s." % channel
if not irc.is_channel(channel):
raise ValueError("Invalid channel name %s." % channel)
if network:
ircobj = world.networkobjects.get(network)
else:
ircobj = irc
assert ircobj, "Unknown network %s" % network
if not ircobj:
raise ValueError("Unknown network %s" % network)
if perm is not None:
# Only check for permissions if we're told to and the irc object exists.