Fix (ratelimit) error handling

This commit is contained in:
Norbi Peti 2019-12-12 22:00:10 +01:00
parent 35629a3e13
commit 3634d6783e
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -83,7 +83,11 @@ namespace HiddenUpdater
var artist = spotify.GetArtist((string) kv.Value["sid"]); var artist = spotify.GetArtist((string) kv.Value["sid"]);
var artJson = kv.Value; var artJson = kv.Value;
if (artist.HasError()) if (artist.HasError())
Console.WriteLine(artist.Name + " - Error: " + artist.Error.Status + " - " + artist.Error.Message); {
Console.WriteLine(kv.Value["sid"] + " - Error: " + artist.Error.Status + " - " + artist.Error.Message);
Thread.Sleep(5000);
artist = spotify.GetArtist((string) kv.Value["sid"]);
}
artJson["followers"] = artist?.Followers?.Total; artJson["followers"] = artist?.Followers?.Total;
artJson["popularity"] = artist?.Popularity; artJson["popularity"] = artist?.Popularity;
artJson["genres"] = new JArray(artist?.Genres); artJson["genres"] = new JArray(artist?.Genres);