From 70c5e2861b29e033d36151f962b7ff314ff87829 Mon Sep 17 00:00:00 2001 From: "Hyunsoo, Park" Date: Fri, 31 Mar 2017 10:23:48 +0900 Subject: [PATCH] [ScreenMirroring] Add Exception checking Before this patch, ScreenMirroringErrorFactory checked 'InvalidOperation' only. After applying this patch, it will check 3 more exception below. -OutOfMemoryException -NotSupportedException -UnauthorizedAccessException Change-Id: I1a819f15cca7f6bcd7603f3cb8db202a9c119c78 Signed-off-by: Hyunsoo, Park --- packaging/csapi-multimedia.spec | 2 +- .../ScreenMirroringErrorFactory.cs | 30 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/packaging/csapi-multimedia.spec b/packaging/csapi-multimedia.spec index a3ab59e36..022257c3d 100755 --- a/packaging/csapi-multimedia.spec +++ b/packaging/csapi-multimedia.spec @@ -1,6 +1,6 @@ Name: csapi-multimedia Summary: Tizen Multimedia API for C# -Version: 1.0.49 +Version: 1.0.50 Release: 0 Group: Development/Libraries License: Apache-2.0 diff --git a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs b/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs index 6c23f7521..8a3ff1946 100755 --- a/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs +++ b/src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringErrorFactory.cs @@ -31,26 +31,42 @@ namespace Tizen.Multimedia }; public class ScreenMirroringErrorFactory { - internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null) + private const string LogTag = "Tizen.Multimedia.ScreenMirroring"; + internal static void ThrowException(int errorCode, string errorMessage = null) { ScreenMirroringError err = (ScreenMirroringError)errorCode; + + if (err == ScreenMirroringError.None) + { + return; + } + + Log.Error(LogTag,"errorCode is : " + errorCode); if (string.IsNullOrEmpty(errorMessage)) { errorMessage = err.ToString(); } - switch ((ScreenMirroringError)errorCode) + switch (err) { case ScreenMirroringError.InvalidParameter: - throw new ArgumentException(errorMessage, paramName); + throw new ArgumentException(errorMessage); case ScreenMirroringError.OutOfMemory: - case ScreenMirroringError.InvalidOperation: - case ScreenMirroringError.ConnectionTimeOut: + throw new OutOfMemoryException(errorMessage); + case ScreenMirroringError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + case ScreenMirroringError.NotSupported: - case ScreenMirroringError.Unknown: - throw new InvalidOperationException(errorMessage); + throw new NotSupportedException(errorMessage); + + case ScreenMirroringError.ConnectionTimeOut: + case ScreenMirroringError.InvalidOperation: + throw new InvalidOperationException(errorMessage); + + default: + throw new Exception("Unknown error : " + errorCode); } } } -- 2.34.1