From 26a5aedd1864a81caf93912e67cf843ac43f300a Mon Sep 17 00:00:00 2001 From: Santa Date: Fri, 31 Mar 2023 21:17:55 +0300 Subject: [PATCH] Rcon Exception handler --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index d65a71e..d39fb1a 100644 --- a/main.py +++ b/main.py @@ -33,8 +33,11 @@ def fix_rcon_text(_srt): def rcon(cmd): - with MCRcon(host, password, port) as mcr: - return fix_rcon_text(mcr.command(cmd)) + try: + with MCRcon(host, password, port) as mcr: + return fix_rcon_text(mcr.command(cmd)) + except Exception as e: + return f"Rcon error" def get_lp_server(): @@ -74,6 +77,7 @@ def main(): exit(0) except Exception as e: + ts = lp.get('ts') print(f"Found exception: {e}") print(traceback.format_exc())