mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
automode: replace assert usage with proper exceptions
This commit is contained in:
parent
09c8b03705
commit
28a62f629a
@ -156,14 +156,16 @@ def _get_channel_pair(irc, source, chanpair, perm=None):
|
|||||||
channel = '#' + channel
|
channel = '#' + channel
|
||||||
channel = irc.to_lower(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:
|
if network:
|
||||||
ircobj = world.networkobjects.get(network)
|
ircobj = world.networkobjects.get(network)
|
||||||
else:
|
else:
|
||||||
ircobj = irc
|
ircobj = irc
|
||||||
|
|
||||||
assert ircobj, "Unknown network %s" % network
|
if not ircobj:
|
||||||
|
raise ValueError("Unknown network %s" % network)
|
||||||
|
|
||||||
if perm is not None:
|
if perm is not None:
|
||||||
# Only check for permissions if we're told to and the irc object exists.
|
# Only check for permissions if we're told to and the irc object exists.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user