[rygel] media-export: Catch additional database errors



commit e4c21d7adb8299947e3974d1e2d981d6018b3f5d
Author: Jens Georg <mail jensge org>
Date:   Fri Aug 14 21:35:17 2009 +0200

    media-export: Catch additional database errors

 .../media-export/rygel-media-export-harvester.vala |   26 ++++++++++++-------
 1 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 7f4104b..92b06cb 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -82,19 +82,25 @@ public class Rygel.MediaExportHarvester : GLib.Object {
 
         // delete all children which are not in filesystem anymore
         var container = (DummyContainer) this.containers.peek_head ();
-        var children = this.media_db.get_child_ids (container.id);
+        try {
+            var children = this.media_db.get_child_ids (container.id);
 
-        foreach (var seen_id in container.seen_children) {
-            children.remove (seen_id);
-        }
+            foreach (var seen_id in container.seen_children) {
+                children.remove (seen_id);
+            }
 
-        foreach (var child in children) {
-            this.media_db.delete_by_id (child);
-        }
+            foreach (var child in children) {
+                this.media_db.delete_by_id (child);
+            }
 
-        if (this.files.get_length() == 0 &&
-            this.containers.get_length () != 0) {
-            this.containers.pop_head ();
+            if (this.files.get_length() == 0 &&
+                    this.containers.get_length () != 0) {
+                this.containers.pop_head ();
+            }
+        } catch (MediaDBError err) {
+            warning("Failed to get children of container %s: %s",
+                    container.id,
+                    err.message);
         }
 
         Idle.add(this.on_idle);



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