From 6a6a1fcca5058eedcd26c280bb003ca189e67815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Sat, 8 Oct 2022 20:43:13 +0200 Subject: Catch exception for QueryServer --- QueryServer.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/QueryServer.py b/QueryServer.py index 9227e5a..230bbee 100755 --- a/QueryServer.py +++ b/QueryServer.py @@ -26,6 +26,7 @@ sourcequeryinc = [107410, 346110] # ARMA III # ARK: Survival Evolved import json import socket import struct + from SteamAPI import SteamAPI if CACHE_TTL > 0: @@ -57,13 +58,16 @@ class QueryServer: socket.setdefaulttimeout(5) if int(gameid) in sourcequery: print("Querying server...") - serverdata = QueryServer._querySourceServer(ip, port, gameid) - - if CACHE_TTL > 0: - serialized = json.dumps(serverdata) - Caching.writeCache( - "server", "%s-%s-%s" % (str(gameid), ip, str(port)), serialized - ) + try: + serverdata = QueryServer._querySourceServer(ip, port, gameid) + + if CACHE_TTL > 0: + serialized = json.dumps(serverdata) + Caching.writeCache( + "server", "%s-%s-%s" % (str(gameid), ip, str(port)), serialized + ) + except Exception: + return None return serverdata -- cgit v1.2.3