Better error handling, change of warning():

This commit is contained in:
Jylpah committed 2021-02-28 01:52:43 +02:00
1 parent c640747a0a
commit c8e219ab45
2 files changed
+8 -5

No files matched your search

+6 -3
View File
@@ -2326,9 +2326,12 @@ async def mk_readerQ_item(replay_json, filename : str = None) -> list:
global REPLAY_N
REPLAY_N +=1
try:
if not '_id' in replay_json:
id = wi.read_replay_id(replay_json)
replay_json['_id'] = id
if wi.chk_JSON_replay(replay_json):
if not '_id' in replay_json:
id = wi.read_replay_id(replay_json)
replay_json['_id'] = id
else:
replay_json = None # mark error
except Exception as err:
bu.error(exception=err)
if filename == None:
+2 -2
View File
@@ -311,7 +311,7 @@ def verbose_std(msg="", id=None) -> bool:
def warning(msg="", id=None, force: bool = False) -> bool:
"""Print a warning message"""
return _print_log_msg('Warning', msg, None, id, print_msg=(force or (_log_level >= NORMAL)))
return _print_log_msg('', 'Warning: ' + msg, None, id, print_msg=(force or (_log_level >= NORMAL)))
def debug(msg="", id=None, exception=None, force: bool = False) -> bool:
@@ -1852,7 +1852,7 @@ class WoTinspector:
# FIX The replay can have allies/enemies i.e. be useful for
# team composition analysis, but does not have player contribution
if ('status' in json_resp) and json_resp['status'] == 'ok' and \
(get_JSON_value(json_resp, key='data.summary.allies') != None) :
(get_JSON_value(json_resp, key='data.summary.winner_team') != None) :
debug("JSON check OK")
return True
except KeyError as err: