replace exception logging with exception level method
This commit is contained in:
parent
b35b4c2b8c
commit
fd2f0b288c
@ -27,10 +27,10 @@ def get_chart_of_spotify_tracks(spotnet: SpotNetwork,
|
|||||||
spotify_chart.append(spotify_search[0])
|
spotify_chart.append(spotify_search[0])
|
||||||
else:
|
else:
|
||||||
logger.debug('no search tracks returned')
|
logger.debug('no search tracks returned')
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error during search function - {e}')
|
logger.exception(f'error during search function')
|
||||||
|
|
||||||
return spotify_chart
|
return spotify_chart
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error during chart retrieval function - {e}')
|
logger.exception(f'error during chart retrieval function')
|
||||||
return []
|
return []
|
||||||
|
@ -38,5 +38,5 @@ class ChartSource(TrackSource):
|
|||||||
fmnet=self.fmnet,
|
fmnet=self.fmnet,
|
||||||
period=params.chart_range,
|
period=params.chart_range,
|
||||||
limit=params.limit)
|
limit=params.limit)
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error occured during chart retrieval - {e}')
|
logger.exception(f'error occured during chart retrieval')
|
||||||
|
@ -45,8 +45,8 @@ class Counter:
|
|||||||
if playlist.has_tracks() is False:
|
if playlist.has_tracks() is False:
|
||||||
try:
|
try:
|
||||||
playlist.tracks = self.spotnet.get_playlist_tracks(uri=playlist.uri)
|
playlist.tracks = self.spotnet.get_playlist_tracks(uri=playlist.uri)
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error occured during playlist track retrieval - {e}')
|
logger.exception(f'error occured during playlist track retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if uri is not None:
|
if uri is not None:
|
||||||
@ -54,8 +54,8 @@ class Counter:
|
|||||||
raise ValueError('uri not a playlist')
|
raise ValueError('uri not a playlist')
|
||||||
try:
|
try:
|
||||||
playlist = self.spotnet.get_playlist(uri=uri, tracks=True)
|
playlist = self.spotnet.get_playlist(uri=uri, tracks=True)
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error occured during playlist retrieval - {e}')
|
logger.exception(f'error occured during playlist retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
scrobble_count = 0
|
scrobble_count = 0
|
||||||
@ -92,8 +92,8 @@ class Counter:
|
|||||||
raise ValueError('uri not a track')
|
raise ValueError('uri not a track')
|
||||||
try:
|
try:
|
||||||
track = self.spotnet.get_track(uri=uri)
|
track = self.spotnet.get_track(uri=uri)
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error occured during track retrieval - {e}')
|
logger.exception(f'error occured during track retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -105,8 +105,8 @@ class Counter:
|
|||||||
else:
|
else:
|
||||||
logger.error(f'no track returned for {track}')
|
logger.error(f'no track returned for {track}')
|
||||||
return 0
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error occured during track retrieval - {e}')
|
logger.exception(f'error occured during track retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def count_album(self, username: str = None, uri: Uri = None, album: SimplifiedAlbum = None) -> int:
|
def count_album(self, username: str = None, uri: Uri = None, album: SimplifiedAlbum = None) -> int:
|
||||||
@ -119,8 +119,8 @@ class Counter:
|
|||||||
raise ValueError('uri not an album')
|
raise ValueError('uri not an album')
|
||||||
try:
|
try:
|
||||||
album = self.spotnet.get_album(uri=uri)
|
album = self.spotnet.get_album(uri=uri)
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error occured during album retrieval - {e}')
|
logger.exception(f'error occured during album retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -132,8 +132,8 @@ class Counter:
|
|||||||
else:
|
else:
|
||||||
logger.error(f'no track returned for {album}')
|
logger.error(f'no track returned for {album}')
|
||||||
return 0
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error occured during album retrieval - {e}')
|
logger.exception(f'error occured during album retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def count_artist(self, username: str = None, uri: Uri = None, artist: SimplifiedArtist = None) -> int:
|
def count_artist(self, username: str = None, uri: Uri = None, artist: SimplifiedArtist = None) -> int:
|
||||||
@ -146,8 +146,8 @@ class Counter:
|
|||||||
raise ValueError('uri not an artist')
|
raise ValueError('uri not an artist')
|
||||||
try:
|
try:
|
||||||
artist = self.spotnet.get_artist(uri=uri)
|
artist = self.spotnet.get_artist(uri=uri)
|
||||||
except SpotifyNetworkException as e:
|
except SpotifyNetworkException:
|
||||||
logger.error(f'error occured during artist retrieval - {e}')
|
logger.exception(f'error occured during artist retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -157,6 +157,6 @@ class Counter:
|
|||||||
else:
|
else:
|
||||||
logger.error(f'no track returned for {artist}')
|
logger.error(f'no track returned for {artist}')
|
||||||
return 0
|
return 0
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error occured during artist retrieval - {e}')
|
logger.exception(f'error occured during artist retrieval')
|
||||||
return 0
|
return 0
|
||||||
|
@ -31,8 +31,8 @@ class Stats(Cmd):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
user_total = self.fmnet.get_user_scrobble_count()
|
user_total = self.fmnet.get_user_scrobble_count()
|
||||||
except LastFMNetworkException as e:
|
except LastFMNetworkException:
|
||||||
logger.error(f'error occured during scrobble count retrieval - {e}')
|
logger.exception(f'error occured during scrobble count retrieval')
|
||||||
user_total = 0
|
user_total = 0
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user