Skip to content

Commit 565d7fd

Browse files
authored
Except YTMusicUserError in auth.py fixes #110 (#111)
Add exceptions thrown by `ytmusicapi`
1 parent c86fc1c commit 565d7fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ytmusic_deleter/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import ytmusicapi
66
from ytmusicapi import YTMusic
7+
from ytmusicapi.exceptions import YTMusicUserError
78

89
from . import common as const
910

@@ -23,7 +24,7 @@ def ensure_auth(credential_dir, oauth) -> YTMusic:
2324
logging.info(f"Attempting authentication with: {auth_file_path}")
2425
yt_auth = YTMusic(auth_file_path)
2526
logging.info(f'Authenticated with: {auth_file_path}"')
26-
except JSONDecodeError:
27+
except (JSONDecodeError, YTMusicUserError, FileNotFoundError):
2728
logging.info(f"Creating file: {auth_file_name}")
2829
if oauth:
2930
ytmusicapi.setup_oauth(filepath=auth_file_path, open_browser=True)

0 commit comments

Comments
 (0)