[rygel] core: Proper error on failed search



commit f121d35fc3e555c7a9dd64cf2fdeff65ac40104a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Nov 6 02:36:58 2009 +0200

    core: Proper error on failed search
    
    This is as par the requirements of ContentDirectory spec.

 src/rygel/rygel-content-directory.vala |    1 +
 src/rygel/rygel-search.vala            |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala
index 6f9b5cc..19a8da3 100644
--- a/src/rygel/rygel-content-directory.vala
+++ b/src/rygel/rygel-content-directory.vala
@@ -30,6 +30,7 @@ using Gee;
  */
 public errordomain Rygel.ContentDirectoryError {
     NO_SUCH_OBJECT = 701,
+    CANT_PROCESS = 720,
     INVALID_ARGS = 402
 }
 
diff --git a/src/rygel/rygel-search.vala b/src/rygel/rygel-search.vala
index a7b195a..8c242ed 100644
--- a/src/rygel/rygel-search.vala
+++ b/src/rygel/rygel-search.vala
@@ -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;



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