Skip to content

Commit

Permalink
insert catchall exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Tseng committed Aug 11, 2021
1 parent 507426b commit 234f974
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion BOGClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
5 changes: 5 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 234f974

Please sign in to comment.