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

proto/inspircd: raise ProtocolError instead of calling sys.exit on errors

This commit is contained in:
James Lu 2015-07-03 18:07:01 -07:00
parent 0f4d3df757
commit 0c8a30323a
2 changed files with 5 additions and 4 deletions

View File

@ -43,3 +43,6 @@ class IrcChannel():
'''
def __repr__(self):
return repr(self.__dict__)
class ProtocolError(Exception):
pass

View File

@ -191,9 +191,8 @@ def handle_part(irc, source, command, args):
del irc.channels[channel]
def handle_error(irc, numeric, command, args):
print('Received an ERROR, killing!')
irc.connected = False
sys.exit(1)
raise ProtocolError('Received an ERROR, killing!')
def handle_fjoin(irc, servernumeric, command, args):
# :70M FJOIN #chat 1423790411 +AFPfjnt 6:5 7:5 9:5 :o,1SRAABIT4 v,1IOAAF53R <...>
@ -331,8 +330,7 @@ def handle_events(irc, data):
numeric = args[4]
if args[2] != irc.serverdata['recvpass']:
# Check if recvpass is correct
print('Error: recvpass from uplink server %s does not match configuration!' % servername)
sys.exit(1)
raise ProtocolError('Error: recvpass from uplink server %s does not match configuration!' % servername)
irc.servers[numeric] = IrcServer(None, servername)
return
try: