[rygel/rygel-0-18] server: Fix error codes for CreateReference



commit 73ff853e71ffa2d605012e6a0a8099f4cb1861a3
Author: Jens Georg <jensg openismus com>
Date:   Tue Jun 18 15:54:22 2013 +0200

    server: Fix error codes for CreateReference
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702083

 src/librygel-server/rygel-content-directory.vala |    1 +
 src/librygel-server/rygel-reference-creator.vala |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/librygel-server/rygel-content-directory.vala 
b/src/librygel-server/rygel-content-directory.vala
index 8ac31b9..9b9a147 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -37,6 +37,7 @@ internal errordomain Rygel.ContentDirectoryError {
     READ_ONLY_TAG = 705,
     PARAMETER_MISMATCH = 706,
     INVALID_SORT_CRITERIA = 709,
+    NO_SUCH_CONTAINER = 710,
     RESTRICTED_OBJECT = 711,
     BAD_METADATA = 712,
     RESTRICTED_PARENT = 713,
diff --git a/src/librygel-server/rygel-reference-creator.vala 
b/src/librygel-server/rygel-reference-creator.vala
index 65fd1e8..bf9cb28 100644
--- a/src/librygel-server/rygel-reference-creator.vala
+++ b/src/librygel-server/rygel-reference-creator.vala
@@ -77,7 +77,11 @@ internal class Rygel.ReferenceCreator : GLib.Object, Rygel.StateMachine {
             this.action.return ();
             this.completed ();
         } catch (Error error) {
-            this.action.return_error (error.code, error.message);
+            if (error is ContentDirectoryError) {
+                this.action.return_error (error.code, error.message);
+            } else {
+                this.action.return_error (402, error.message);
+            }
 
             warning (_("Failed to create object under '%s': %s"),
                      this.container_id,
@@ -107,7 +111,7 @@ internal class Rygel.ReferenceCreator : GLib.Object, Rygel.StateMachine {
                                                          this.cancellable);
 
         if (media_object == null || !(media_object is MediaContainer)) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT
+            throw new ContentDirectoryError.NO_SUCH_CONTAINER
                                         (_("No such object"));
         } else if (!(OCMFlags.UPLOAD in media_object.ocm_flags) ||
                    !(media_object is WritableContainer)) {


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