From 15d83f24ce5fbb267f65bcaf5f1d6901044258d2 Mon Sep 17 00:00:00 2001 From: Sean Reifschneider Date: Sat, 10 Feb 2024 18:25:53 -0700 Subject: [PATCH] Trying a nav() debug wrapper --- spotify2ytmusic/cli.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spotify2ytmusic/cli.py b/spotify2ytmusic/cli.py index b72d540..d2aca22 100644 --- a/spotify2ytmusic/cli.py +++ b/spotify2ytmusic/cli.py @@ -6,6 +6,23 @@ from . import backend +import ytmusicapi.navigation as navigation + +original_nav = navigation.nav + + +def debug_nav_wrapper(*args, **kwargs): + try: + return original_nav(*args, **kwargs) + except KeyError as e: + print( + f"NAV was called with args={args!r} kwargs={kwargs!r}, raised exception: {e}" + ) + raise + + +navigation.nav = debug_nav_wrapper + def list_liked_albums(): """