[banshee] Lastfm: Handle errors when fetching Last.fm user data (bgo#646539)



commit 7fc51c64b4f9067c58232e79c6357f64a0179572
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Apr 3 15:24:50 2011 +0200

    Lastfm: Handle errors when fetching Last.fm user data (bgo#646539)

 .../Banshee.Lastfm/LastfmSourceContents.cs         |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSourceContents.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSourceContents.cs
index 2209472..a6819e3 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSourceContents.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm/LastfmSourceContents.cs
@@ -132,10 +132,15 @@ namespace Banshee.Lastfm
             main_box.PackStart (top_artists, false, false, 0);
             //PackStart (recommended_artists, true, true, 0);
 
-            user = new LastfmUserData (username);
-            recently_loved.SetList (user.RecentLovedTracks);
-            recently_played.SetList (user.RecentTracks);
-            top_artists.SetList (user.GetTopArtists (TopType.Overall));
+            try {
+                user = new LastfmUserData (username);
+                recently_loved.SetList (user.RecentLovedTracks);
+                recently_played.SetList (user.RecentTracks);
+                top_artists.SetList (user.GetTopArtists (TopType.Overall));
+            } catch (Exception e) {
+                lastfm.SetStatus ("Failed to get information from your Last.fm profile", true, ConnectionState.InvalidAccount);
+                Log.Exception (String.Format ("LastfmUserData query failed for {0}", username), e);
+            }
 
             ShowAll ();
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]