From e9ec9391a095ae55893d521475a01311094b5f98 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 28 Apr 2022 15:10:17 +0100 Subject: [PATCH] svc/connect.in: Change the idiom for handling peer nonexistence. Use `try/except/else' rather than `try/except return'. It's hardly more writing for a better code structure. --- svc/connect.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/svc/connect.in b/svc/connect.in index cb640000..cec1e3ff 100644 --- a/svc/connect.in +++ b/svc/connect.in @@ -757,12 +757,12 @@ def notify(_, code, *rest): """ if code == 'ADD': try: p = Peer(rest[0]) - except KeyError: return - adoptpeer(p, *rest[1:]) + except KeyError: pass + else: adoptpeer(p, *rest[1:]) elif code == 'KILL': try: p = Peer(rest[0]) - except KeyError: return - disownpeer(p, *rest[1:]) + except KeyError: pass + else: disownpeer(p, *rest[1:]) elif code == 'GREET': chal = rest[0] try: cr = chalmap[chal] -- 2.11.0