[Content] Return correct error code if name is duplicated.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 30 Jul 2015 08:58:23 +0000 (10:58 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 30 Jul 2015 08:58:28 +0000 (10:58 +0200)
Fixes: UTC_content_playlist_name_N_001
[Verification] Wearable service UTC: 43/55
               Mobile TCT: 230/230

Change-Id: I0cbb3023f0823d8b748dee494591bc3568b4c721
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/content/content_manager.cc

index 87efc0656fc9691f6e57a0cee107367d3d71869c..31101570b2e98d5390dbcd26b393cee12d8f5df6 100755 (executable)
@@ -1370,7 +1370,7 @@ int updatePlaylistInDB(media_playlist_h playlist_handle)
   int ret_code = media_playlist_update_to_db(playlist_handle);
   if(MEDIA_CONTENT_ERROR_NONE != ret_code) {
     LoggerE("media_playlist_update_to_db failed");
-    return TIZEN_ERROR_UNKNOWN;
+    return ret_code;
   }
   return MEDIA_CONTENT_ERROR_NONE;
 }
@@ -1397,10 +1397,11 @@ int ContentManager::setPlaylistName(int id, const std::string& name)
   int ret = updatePlaylistInDB(playlist_handle);
   if (MEDIA_CONTENT_ERROR_NONE != ret) {
     LoggerE("Error while updating playlist: %d", ret);
-    if (MEDIA_CONTENT_ERROR_INVALID_OPERATION == ret) {
+    if (MEDIA_CONTENT_ERROR_DB_FAILED == ret) {
       //We could fetch list of playlists and check if other playlist is using this
       //name, but that seems to be to much work in synchronous method
       LoggerE("Playlist name: %s is probably already used", name.c_str());
+      return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
     }
     return ret;
   }