mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
proto/inspircd: raise ProtocolError instead of calling sys.exit on errors
This commit is contained in:
parent
0f4d3df757
commit
0c8a30323a
@ -43,3 +43,6 @@ class IrcChannel():
|
|||||||
'''
|
'''
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return repr(self.__dict__)
|
return repr(self.__dict__)
|
||||||
|
|
||||||
|
class ProtocolError(Exception):
|
||||||
|
pass
|
||||||
|
@ -191,9 +191,8 @@ def handle_part(irc, source, command, args):
|
|||||||
del irc.channels[channel]
|
del irc.channels[channel]
|
||||||
|
|
||||||
def handle_error(irc, numeric, command, args):
|
def handle_error(irc, numeric, command, args):
|
||||||
print('Received an ERROR, killing!')
|
|
||||||
irc.connected = False
|
irc.connected = False
|
||||||
sys.exit(1)
|
raise ProtocolError('Received an ERROR, killing!')
|
||||||
|
|
||||||
def handle_fjoin(irc, servernumeric, command, args):
|
def handle_fjoin(irc, servernumeric, command, args):
|
||||||
# :70M FJOIN #chat 1423790411 +AFPfjnt 6:5 7:5 9:5 :o,1SRAABIT4 v,1IOAAF53R <...>
|
# :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]
|
numeric = args[4]
|
||||||
if args[2] != irc.serverdata['recvpass']:
|
if args[2] != irc.serverdata['recvpass']:
|
||||||
# Check if recvpass is correct
|
# Check if recvpass is correct
|
||||||
print('Error: recvpass from uplink server %s does not match configuration!' % servername)
|
raise ProtocolError('Error: recvpass from uplink server %s does not match configuration!' % servername)
|
||||||
sys.exit(1)
|
|
||||||
irc.servers[numeric] = IrcServer(None, servername)
|
irc.servers[numeric] = IrcServer(None, servername)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user