core: Proper error on failed search
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 6 Nov 2009 00:36:58 +0000 (02:36 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 6 Nov 2009 00:36:58 +0000 (02:36 +0200)
This is as par the requirements of ContentDirectory spec.

src/rygel/rygel-content-directory.vala
src/rygel/rygel-search.vala

index 6f9b5cc..19a8da3 100644 (file)
@@ -30,6 +30,7 @@ using Gee;
  */
 public errordomain Rygel.ContentDirectoryError {
     NO_SUCH_OBJECT = 701,
+    CANT_PROCESS = 720,
     INVALID_ARGS = 402
 }
 
index a7b195a..8c242ed 100644 (file)
@@ -131,6 +131,12 @@ internal class Rygel.Search: GLib.Object, Rygel.StateMachine {
                                               this.requested_count,
                                               out this.total_matches,
                                               this.cancellable);
+        if (results.size == 0) {
+            throw new ContentDirectoryError.CANT_PROCESS (
+                                        "No objects found that could setisfy" +
+                                        " the given search criteria.");
+        }
+
         this.number_returned = results.size;
 
         return results;