From 234f9740d3bab115d28ea8bd88696dfd98fd462d Mon Sep 17 00:00:00 2001 From: Derick Tseng Date: Wed, 11 Aug 2021 13:31:34 -0700 Subject: [PATCH] insert catchall exception handling --- BOGClient.py | 2 +- utils.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/BOGClient.py b/BOGClient.py index 1474039..c2351b2 100644 --- a/BOGClient.py +++ b/BOGClient.py @@ -47,5 +47,5 @@ async def on_message(self, message: Message): await message.reply('Unable to access replay') except (ReadError, ReplayFormatError) as e: # parse errors spawning tool await message.reply('This does not look like a replay') - except (KeyError) as e: # needed if gets an SC2Replay arcade file gets uploaded + except: # needed if we get an unparsable replay await message.reply('Unable to parse replay') diff --git a/utils.py b/utils.py index f6887d8..285c042 100644 --- a/utils.py +++ b/utils.py @@ -45,6 +45,11 @@ def arr_to_string(arr: list, cutoff=float('inf')) -> str: """ # removes empty columns from arr lst = [col for col in arr if col] + + # catches the error if lst is empty, otherwise max complains + if not lst: + return '' + max_lines = max([len(col) for col in lst]) paddings = [len(col[0]) for col in lst]