Skip to content

Commit

Permalink
logged the last error message for each exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNima committed Apr 19, 2023
1 parent 2e0b0a8 commit d1259c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ def retry(max_retries, on_fail):
def wrapper(fn):
def inner(*args, **kwargs):
so_far = 0
exceptions = set()
exceptions = {}
while so_far <= max_retries:
try:
return fn(*args, **kwargs)
except Exception as e:
exceptions.add(str(e))
exceptions[type(e)] = str(e)
so_far += 1
return on_fail('\n'.join(exceptions))
return on_fail('\n'.join(exceptions.values()))
return inner
return wrapper

0 comments on commit d1259c2

Please sign in to comment.