From ad72e1a6dee4d48aea137e4bc9e3778bd506b3c7 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 2 Apr 2024 17:27:21 -0700 Subject: [PATCH] [BACKEND] Debug log exception on retry (#957) Help diagnose retry errors better --- src/ytdl_sub/utils/retry.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ytdl_sub/utils/retry.py b/src/ytdl_sub/utils/retry.py index 01712381..4704a2e5 100644 --- a/src/ytdl_sub/utils/retry.py +++ b/src/ytdl_sub/utils/retry.py @@ -34,12 +34,14 @@ def retry(times: int, exceptions: Tuple[Type[Exception], ...], wait_sec: int = 5 while attempt < times: try: return func(*args, **kwargs) - except exceptions: + except exceptions as exc: logger.debug( - "Exception thrown when attempting to run %s, attempt %d of %d", + "Exception thrown when attempting to run %s, attempt %d of %d\n" + "Exception:\n%s", func.__name__, attempt + 1, times, + str(exc), ) attempt += 1 sleep(wait_sec)