From b16901ebff2e0748ffba6a1fbfb8fce643ba762e Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Thu, 15 Jun 2017 17:04:11 +0900 Subject: [PATCH] Add exception tag Change-Id: I0a9419bddf1628de54b2e07462ba2f8b04561855 Signed-off-by: Seonah Moon --- .../Tizen.Content.Download.csproj | 2 +- .../Tizen.Content.Download/DownloadErrorFactory.cs | 4 +- .../Tizen.Content.Download/Notification.cs | 18 ++++++ .../Tizen.Content.Download/Request.cs | 75 ++++++++++++++++++++++ 4 files changed, 96 insertions(+), 3 deletions(-) diff --git a/Tizen.Content.Download/Tizen.Content.Download.csproj b/Tizen.Content.Download/Tizen.Content.Download.csproj index 582fa62..758b844 100644 --- a/Tizen.Content.Download/Tizen.Content.Download.csproj +++ b/Tizen.Content.Download/Tizen.Content.Download.csproj @@ -1,7 +1,7 @@  - 1.0.5 + 1.0.6 Samsung Electronics © Samsung Electronics Co., Ltd All Rights Reserved Provides the Download API for Tizen .NET diff --git a/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs b/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs index adaf3af..b6fd77f 100755 --- a/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs +++ b/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs @@ -70,8 +70,6 @@ namespace Tizen.Content.Download case DownloadError.NetworkUnreachable: case DownloadError.ConnectionTimedOut: case DownloadError.NoSpace: - case DownloadError.PermissionDenied: - case DownloadError.NotSupported: case DownloadError.InvalidState: case DownloadError.ConnectionFailed: case DownloadError.TooManyDownloads: @@ -88,6 +86,8 @@ namespace Tizen.Content.Download case DownloadError.IdNotFound: case DownloadError.NoData: case DownloadError.IoError: throw new InvalidOperationException(errorMessage); + case DownloadError.NotSupported: throw new NotSupportedException(errorMessage); + case DownloadError.PermissionDenied: throw new UnauthorizedAccessException(errorMessage); } } } diff --git a/Tizen.Content.Download/Tizen.Content.Download/Notification.cs b/Tizen.Content.Download/Tizen.Content.Download/Notification.cs index 72f5377..0524e5b 100755 --- a/Tizen.Content.Download/Tizen.Content.Download/Notification.cs +++ b/Tizen.Content.Download/Tizen.Content.Download/Notification.cs @@ -39,6 +39,9 @@ namespace Tizen.Content.Download /// If user tries to get before setting, empty string is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string Title { get @@ -67,6 +70,9 @@ namespace Tizen.Content.Download /// If user tries to get before setting, empty string is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string Description { get @@ -95,6 +101,9 @@ namespace Tizen.Content.Download /// If user tries to get before setting, default NotificationType None is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public NotificationType Type { get @@ -126,6 +135,9 @@ namespace Tizen.Content.Download /// /// When the notification message is clicked, the action is decided by the app control. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public AppControl AppControlOngoing { get @@ -157,6 +169,9 @@ namespace Tizen.Content.Download /// /// When the notification message is clicked, the action is decided by the app control /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public AppControl AppControlCompleted { get @@ -188,6 +203,9 @@ namespace Tizen.Content.Download /// /// When the notification message is clicked, the action is decided by the app control /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public AppControl AppControlFailed { get diff --git a/Tizen.Content.Download/Tizen.Content.Download/Request.cs b/Tizen.Content.Download/Tizen.Content.Download/Request.cs index 0e8e4e7..d7fdfd7 100755 --- a/Tizen.Content.Download/Tizen.Content.Download/Request.cs +++ b/Tizen.Content.Download/Tizen.Content.Download/Request.cs @@ -39,6 +39,9 @@ namespace Tizen.Content.Download /// /// URL to download /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public Request(string url) { if (String.IsNullOrEmpty(url)) @@ -70,6 +73,10 @@ namespace Tizen.Content.Download /// http://tizen.org/feature/network.wifi /// http://tizen.org/feature/network.wifi.direct /// http://tizen.org/feature/network.telephony + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when feature is not supported. public Request(string url, string destinationPath, string fileName, NetworkType type) { if (String.IsNullOrEmpty(url)) @@ -122,6 +129,10 @@ namespace Tizen.Content.Download /// http://tizen.org/feature/network.wifi /// http://tizen.org/feature/network.wifi.direct /// http://tizen.org/feature/network.telephony + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when features is not supported. public Request(string url, string destinationPath, string fileName, NetworkType type, IDictionary httpHeaders) { if (String.IsNullOrEmpty(url)) @@ -171,6 +182,9 @@ namespace Tizen.Content.Download /// Event that occurs when the download state changes. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public event EventHandler StateChanged { add @@ -195,6 +209,9 @@ namespace Tizen.Content.Download /// Event that occurs when the download progress changes. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public event EventHandler ProgressChanged { add @@ -223,6 +240,9 @@ namespace Tizen.Content.Download /// /// Returns empty string if download is not completed or if state has not yet changed to Completed or if any other error occurs. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string DownloadedPath { get @@ -243,6 +263,9 @@ namespace Tizen.Content.Download /// If you try to get this property value before calling Start(), an empty string is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string MimeType { get @@ -262,6 +285,9 @@ namespace Tizen.Content.Download /// Current state of the download. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public DownloadState State { get @@ -283,6 +309,9 @@ namespace Tizen.Content.Download /// If you try to get this property value before calling Start(), an empty string is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string ContentName { get @@ -304,6 +333,9 @@ namespace Tizen.Content.Download /// If you try to get this property value before calling Start(), 0 is returned. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public ulong ContentSize { get @@ -327,6 +359,9 @@ namespace Tizen.Content.Download /// /// State of download request must be DownlodState.Failed. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public int HttpStatus { get @@ -351,6 +386,9 @@ namespace Tizen.Content.Download /// The etag value is available or not depending on the web server. If not available, then on get of the property null is returned. /// After download is started, it can get the etag value. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string ETagValue { get @@ -391,6 +429,9 @@ namespace Tizen.Content.Download /// /// The download state must be one of the states after Downloading. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string TemporaryPath { get @@ -414,6 +455,9 @@ namespace Tizen.Content.Download /// Should be set before calling Start(). /// If you try to get this property value before setting or if any other error occurs, an empty string is returned. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string Url { get @@ -449,6 +493,10 @@ namespace Tizen.Content.Download /// /// Should be set before calling Start(). /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when feature is not supported. public NetworkType AllowedNetworkType { get @@ -480,6 +528,9 @@ namespace Tizen.Content.Download /// /// Should be set before calling Start(). /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string DestinationPath { get @@ -511,6 +562,9 @@ namespace Tizen.Content.Download /// /// Should be set before calling Start(). /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public string FileName { get @@ -543,6 +597,9 @@ namespace Tizen.Content.Download /// /// The default value is false. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public bool AutoDownload { get @@ -593,6 +650,9 @@ namespace Tizen.Content.Download /// If the etag value is not present in the download database, it is not useful to set the temporary file path. /// When resuming the download request, the data is attached at the end of this temporary file. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public void SetTemporaryFilePath(string path) { int ret = Interop.Download.SetTempFilePath(_downloadId, path); @@ -610,6 +670,9 @@ namespace Tizen.Content.Download /// /// The URL is the mandatory information to start the download. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public void Start() { int ret = (int)DownloadError.None; @@ -636,6 +699,9 @@ namespace Tizen.Content.Download /// /// The paused download request can be restarted with Start() or canceled with Cancel(). /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public void Pause() { int ret = Interop.Download.PauseDownload(_downloadId); @@ -652,6 +718,9 @@ namespace Tizen.Content.Download /// /// The canceled download can be restarted with Start(). /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public void Cancel() { int ret = Interop.Download.CancelDownload(_downloadId); @@ -668,6 +737,9 @@ namespace Tizen.Content.Download /// /// After calling this method, download request related data exists in the download database for a certain period of time. Within that time, it is possible to use other APIs with this data. /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. public void Dispose() { Dispose(true); @@ -678,6 +750,9 @@ namespace Tizen.Content.Download /// Deletes the corresponding download request. /// /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. protected virtual void Dispose(bool disposing) { if (_disposed) -- 2.7.4