Upgrading Spotify Invalid Input Dealing

This commit is contained in:
Rafael Vargas
2022-07-10 14:18:07 -03:00
parent 8336a95eda
commit 7e9a6d45c0
4 changed files with 69 additions and 27 deletions

View File

@@ -29,8 +29,14 @@ class Searcher():
elif provider == Provider.Spotify:
try:
musics = self.__Spotify.search(track)
if musics == None or len(musics) == 0:
raise SpotifyError(self.__messages.SPOTIFY_ERROR, self.__messages.GENERIC_TITLE)
return musics
except:
except SpotifyError as error:
raise error # Redirect already processed error
except Exception as e:
print(f'[Spotify Error] -> {e}')
raise SpotifyError(self.__messages.SPOTIFY_ERROR, self.__messages.GENERIC_TITLE)
elif provider == Provider.Name: