[banshee] YouTube: Try to better handle errors when downloading content



commit 1ac17764788c06b9e7091da03feeaebd3d61376e
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Wed Sep 7 20:14:25 2011 +0200

    YouTube: Try to better handle errors when downloading content
    
    Make sure DataFetch.DownloadContent returns null in case there's an
    exception during the download. This is an attempt to fix bgo#657537.
    
    YouTubeTileData doesn't need to catch exceptions when calling
    DataFetch.DownloadContent, as they are caught inside the method.

 .../Banshee.YouTube.Data/DataFetch.cs              |    1 +
 .../Banshee.YouTube.Gui/YouTubeTile.cs             |    9 ++-------
 2 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
index 8f4a065..56394f6 100644
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
@@ -126,6 +126,7 @@ namespace Banshee.YouTube.Data
                 }
             } catch (Exception e) {
                 Log.DebugException (e);
+                cache_file = null;
             }
             return cache_file;
         }
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs
index 707c1d0..a4bf1ce 100644
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs
@@ -91,13 +91,8 @@ namespace Banshee.YouTube.Gui
                 Log.DebugException (e);
             }
 
-            try {
-                DataFetch df = new DataFetch ();
-                Thumbnail = df.DownloadContent (video.Thumbnails[0].Url, CacheDuration.Normal);
-            } catch (Exception e) {
-                Log.DebugException (e);
-                Thumbnail = null;
-            }
+            DataFetch df = new DataFetch ();
+            Thumbnail = df.DownloadContent (video.Thumbnails[0].Url, CacheDuration.Normal);
         }
 
         private static string GetPlaybackUri (Video yt_video)



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