[MetadataEditor] Update exception description (#1776)
authorhsgwon <haesu.gwon@samsung.com>
Wed, 8 Jul 2020 01:28:34 +0000 (10:28 +0900)
committerGitHub <noreply@github.com>
Wed, 8 Jul 2020 01:28:34 +0000 (10:28 +0900)
* [Metadata] Update exception description

src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs
src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorError.cs

index 93edb73..a7fa284 100644 (file)
@@ -118,7 +118,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the artist of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Artist
         {
@@ -137,7 +143,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the title of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Title
         {
@@ -156,7 +168,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the album name of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Album
         {
@@ -175,7 +193,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the genre of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Genre
         {
@@ -194,7 +218,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the author of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Author
         {
@@ -213,7 +243,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the copyright of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Copyright
         {
@@ -236,7 +272,13 @@ namespace Tizen.Multimedia
         /// If the media contains the ID3 tag, this refers to the recorded date.
         /// If the media is a mp4 format, this refers to the year, and the value to set will be converted into integer.
         /// </remarks>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Date
         {
@@ -255,7 +297,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the description of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Description
         {
@@ -274,7 +322,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the comment of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Comment
         {
@@ -293,7 +347,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the track number of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string TrackNumber
         {
@@ -322,7 +382,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the conductor of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string Conductor
         {
@@ -341,7 +407,13 @@ namespace Tizen.Multimedia
         /// Gets or sets the unsynchronized lyrics of media.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        /// <exception cref="InvalidOperationException">The file is read-only.</exception>
+        /// <exception cref="InvalidOperationException">
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
+        /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         public string UnsyncLyrics
         {
@@ -360,9 +432,9 @@ namespace Tizen.Multimedia
         /// Writes the modified metadata to the media file.
         /// </summary>
         /// <exception cref="InvalidOperationException">
-        ///     An internal error occurs.<br/>
-        ///     -or-<br/>
-        ///     The file is read-only.
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// Internal error.<br/>
         /// </exception>
         /// <exception cref="ObjectDisposedException">The <see cref="MetadataEditor"/> has already been disposed of.</exception>
         /// <since_tizen> 3 </since_tizen>
@@ -441,9 +513,11 @@ namespace Tizen.Multimedia
         /// <since_tizen> 3 </since_tizen>
         /// <param name="path">The path of the picture for adding to the metadata.</param>
         /// <exception cref="InvalidOperationException">
-        ///     An internal error occurs.<br/>
-        ///     -or-<br/>
-        ///     The media file is read-only.
+        /// The file is read-only.<br/>
+        /// -or-<br/>
+        /// The malformed file which cannot be updatable.<br/>
+        /// -or-<br/>
+        /// Internal error.
         /// </exception>
         /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
         /// <exception cref="FileNotFoundException">The file does not exist.</exception>
index 7ae1680..9256900 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
@@ -32,7 +32,8 @@ namespace Tizen.Multimedia
         PermissionDenied = ErrorCode.PermissionDenied,
         NotSupported = ErrorCode.NotSupported,
         TizenMetadataEditorError = -0x019C0000,
-        OperationFailed = TizenMetadataEditorError | 0x01
+        OperationFailed = TizenMetadataEditorError | 0x01,
+        UpdateNotPossible = TizenMetadataEditorError | 0x02
     }
 
     internal static class MetadataEditorErrorExtensions
@@ -44,27 +45,29 @@ namespace Tizen.Multimedia
                 return;
             }
 
+            var errorMessages = $"{errorCode.ToString()} : {errorMessage}";
+
             switch (errorCode)
             {
                 case MetadataEditorError.InvalidParameter:
-                    throw new ArgumentException(errorMessage);
+                    throw new ArgumentException(errorMessages);
 
                 case MetadataEditorError.OutOfMemory:
-                    throw new OutOfMemoryException(errorMessage);
+                    throw new OutOfMemoryException(errorMessages);
 
                 case MetadataEditorError.FileNotExists:
-                    throw new FileNotFoundException(errorMessage);
+                    throw new FileNotFoundException(errorMessages);
 
                 case MetadataEditorError.PermissionDenied:
-                    throw new UnauthorizedAccessException(errorMessage);
+                    throw new UnauthorizedAccessException(errorMessages);
 
                 case MetadataEditorError.NotSupported:
-                    throw new FileFormatException(errorMessage);
+                    throw new FileFormatException(errorMessages);
 
                 case MetadataEditorError.OperationFailed:
-                    throw new InvalidOperationException(errorMessage);
+                case MetadataEditorError.UpdateNotPossible:
+                    throw new InvalidOperationException(errorMessages);
             }
         }
     }
 }
-