server: Fix UPnP Error codes
authorParthiban Balasubramanian <p.balasubramanian@cablelabs.com>
Wed, 12 Jun 2013 20:57:01 +0000 (14:57 -0600)
committerJens Georg <jensg@openismus.com>
Thu, 27 Jun 2013 09:14:51 +0000 (11:14 +0200)
CreateObject, UpdateObject and DestroyObject UPnP Actions were using
slightly wrong error codes.

https://bugzilla.gnome.org/show_bug.cgi?id=703140

src/librygel-server/rygel-item-destroyer.vala
src/librygel-server/rygel-item-updater.vala
src/librygel-server/rygel-object-creator.vala

index 3c960a6..ba42f2e 100644 (file)
@@ -49,8 +49,8 @@ internal class Rygel.ItemDestroyer: GLib.Object, Rygel.StateMachine {
             this.action.get ("ObjectID", typeof (string), out this.object_id);
             if (this.object_id == null) {
                 // Sorry we can't do anything without the ID
-                throw new ContentDirectoryError.NO_SUCH_OBJECT
-                                        (_("No such object"));
+                throw new ContentDirectoryError.INVALID_ARGS
+                                        (_("ContainerID missing"));
             }
 
             yield this.remove_object ();
index 6eba9a0..9f1870e 100644 (file)
@@ -66,8 +66,8 @@ internal class Rygel.ItemUpdater: GLib.Object, Rygel.StateMachine {
                                  out this.new_tag_value);
             if (this.object_id == null) {
                 // Sorry we can't do anything without the ID
-                throw new ContentDirectoryError.NO_SUCH_OBJECT
-                                        (_("No such object"));
+                throw new ContentDirectoryError.INVALID_ARGS
+                                        (_("Object id missing"));
             }
 
             yield this.update_object ();
index 97e471e..ddead31 100644 (file)
@@ -251,7 +251,7 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
         }
 
         if (didl_object.restricted) {
-            throw new ContentDirectoryError.INVALID_ARGS
+            throw new ContentDirectoryError.BAD_METADATA
                                         (_("Cannot create restricted item"));
         }
     }
@@ -345,8 +345,8 @@ internal class Rygel.ObjectCreator: GLib.Object, Rygel.StateMachine {
         }
 
         if (media_object == null || !(media_object is MediaContainer)) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT
-                                        (_("No such object"));
+            throw new ContentDirectoryError.NO_SUCH_CONTAINER
+                                        (_("No such container"));
         } else if (!(OCMFlags.UPLOAD in media_object.ocm_flags) ||
                    !(media_object is WritableContainer)) {
             throw new ContentDirectoryError.RESTRICTED_PARENT