[Camera] refactoring (#239)
authorhsgwon <haesu.gwon@samsung.com>
Tue, 8 May 2018 07:10:56 +0000 (16:10 +0900)
committerGitHub <noreply@github.com>
Tue, 8 May 2018 07:10:56 +0000 (16:10 +0900)
src/Tizen.Multimedia.Camera/Camera/Camera.cs
src/Tizen.Multimedia.Camera/Camera/CameraCapabilities.cs
src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs [changed mode: 0755->0644]
src/Tizen.Multimedia.Camera/Camera/CameraError.cs [moved from src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs with 95% similarity]
src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs

index 6359f0e..030d343 100644 (file)
@@ -59,8 +59,7 @@ namespace Tizen.Multimedia
                 throw new NotSupportedException("Camera feature is not supported.");
             }
 
-            CameraErrorFactory.ThrowIfError(Native.Create(device, out _handle),
-                "Failed to create camera instance");
+            Native.Create(device, out _handle).ThrowIfFailed("Failed to create camera instance");
 
             Capabilities = new CameraCapabilities(this);
             Settings = new CameraSettings(this);
@@ -445,7 +444,7 @@ namespace Tizen.Multimedia
                     throw new ArgumentException("The display has already been assigned to another.");
                 }
 
-                CameraErrorFactory.ThrowIfError(SetDisplay(value), "Failed to set the camera display");
+                SetDisplay(value).ThrowIfFailed("Failed to set the camera display");
 
                 ReplaceDisplay(value);
             }
@@ -477,8 +476,8 @@ namespace Tizen.Multimedia
                 ValidateNotDisposed();
 
                 CameraState val = CameraState.None;
-                CameraErrorFactory.ThrowIfError(Native.GetState(_handle, out val),
-                    "Failed to get camera state");
+
+                Native.GetState(_handle, out val).ThrowIfFailed("Failed to get camera state");
 
                 return val;
             }
@@ -499,8 +498,7 @@ namespace Tizen.Multimedia
             {
                 ValidateNotDisposed();
 
-                CameraErrorFactory.ThrowIfError(Native.GetDisplayReuseHint(_handle, out bool val),
-                    "Failed to get camera display reuse hint");
+                Native.GetDisplayReuseHint(_handle, out bool val).ThrowIfFailed("Failed to get camera display reuse hint");
 
                 return val;
             }
@@ -509,8 +507,7 @@ namespace Tizen.Multimedia
             {
                 ValidateState(CameraState.Preview);
 
-                CameraErrorFactory.ThrowIfError(Native.SetDisplayReuseHint(_handle, value),
-                    "Failed to set display reuse hint.");
+                Native.SetDisplayReuseHint(_handle, value).ThrowIfFailed("Failed to set display reuse hint.");
             }
         }
 
@@ -526,8 +523,7 @@ namespace Tizen.Multimedia
             {
                 ValidateNotDisposed();
 
-                CameraErrorFactory.ThrowIfError(Native.GetFacingDirection(_handle, out var val),
-                    "Failed to get camera direction");
+                Native.GetFacingDirection(_handle, out var val).ThrowIfFailed("Failed to get camera direction");
 
                 return val;
             }
@@ -546,8 +542,7 @@ namespace Tizen.Multimedia
             {
                 ValidateNotDisposed();
 
-                CameraErrorFactory.ThrowIfError(Native.GetDeviceCount(_handle, out int val),
-                    "Failed to get camera device count");
+                Native.GetDeviceCount(_handle, out int val).ThrowIfFailed("Failed to get camera device count");
 
                 return val;
             }
@@ -576,8 +571,7 @@ namespace Tizen.Multimedia
             ValidateState(CameraState.Created);
             ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
 
-            CameraErrorFactory.ThrowIfError(Native.ChangeDevice(_handle, device),
-                "Failed to change the camera device");
+            Native.ChangeDevice(_handle, device).ThrowIfFailed("Failed to change the camera device");
         }
 
         /// <summary>
@@ -594,8 +588,7 @@ namespace Tizen.Multimedia
         {
             ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
 
-            CameraErrorFactory.ThrowIfError(Native.GetDeviceState(device, out var val),
-                "Failed to get the camera device state.");
+            Native.GetDeviceState(device, out var val).ThrowIfFailed("Failed to get the camera device state.");
 
             return val;
         }
@@ -614,8 +607,7 @@ namespace Tizen.Multimedia
         {
             ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device));
 
-            CameraErrorFactory.ThrowIfError(Native.GetFlashState(device, out var val),
-                "Failed to get camera flash state");
+            Native.GetFlashState(device, out var val).ThrowIfFailed("Failed to get camera flash state");
 
             return val;
         }
@@ -639,8 +631,7 @@ namespace Tizen.Multimedia
         {
             ValidateState(CameraState.Created, CameraState.Captured);
 
-            CameraErrorFactory.ThrowIfError(Native.StartPreview(_handle),
-                "Failed to start the camera preview.");
+            Native.StartPreview(_handle).ThrowIfFailed("Failed to start the camera preview.");
 
             // Update by StateChangedCallback can be delayed for dozens of milliseconds.
             SetState(CameraState.Preview);
@@ -661,8 +652,7 @@ namespace Tizen.Multimedia
         {
             ValidateState(CameraState.Preview);
 
-            CameraErrorFactory.ThrowIfError(Native.StopPreview(_handle),
-                "Failed to stop the camera preview.");
+            Native.StopPreview(_handle).ThrowIfFailed("Failed to stop the camera preview.");
 
             SetState(CameraState.Created);
         }
@@ -689,8 +679,8 @@ namespace Tizen.Multimedia
         {
             ValidateState(CameraState.Preview);
 
-            CameraErrorFactory.ThrowIfError(Native.StartCapture(_handle, _capturingCallback, _captureCompletedCallback, IntPtr.Zero),
-                "Failed to start the camera capture.");
+            Native.StartCapture(_handle, _capturingCallback, _captureCompletedCallback, IntPtr.Zero).
+                ThrowIfFailed("Failed to start the camera capture.");
 
             SetState(CameraState.Capturing);
         }
@@ -739,14 +729,13 @@ namespace Tizen.Multimedia
             {
                 cancellationToken.Register(() =>
                 {
-                    CameraErrorFactory.ThrowIfError(Native.StopContinuousCapture(_handle),
-                        "Failed to cancel the continuous capture");
+                    Native.StopContinuousCapture(_handle).ThrowIfFailed("Failed to cancel the continuous capture");
                     SetState(CameraState.Captured);
                 });
             }
 
-            CameraErrorFactory.ThrowIfError(Native.StartContinuousCapture(_handle, count, interval,
-                _capturingCallback, _captureCompletedCallback, IntPtr.Zero), "Failed to start the continuous capture.");
+            Native.StartContinuousCapture(_handle, count, interval, _capturingCallback, _captureCompletedCallback, IntPtr.Zero).
+                ThrowIfFailed("Failed to start the continuous capture.");
 
             SetState(CameraState.Capturing);
         }
@@ -771,8 +760,7 @@ namespace Tizen.Multimedia
         {
             ValidateState(CameraState.Preview, CameraState.Captured);
 
-            CameraErrorFactory.ThrowIfError(Native.StartFocusing(_handle, continuous),
-                "Failed to cancel the camera focus.");
+            Native.StartFocusing(_handle, continuous).ThrowIfFailed("Failed to cancel the camera focus.");
         }
 
         /// <summary>
@@ -790,8 +778,7 @@ namespace Tizen.Multimedia
         {
             ValidateState(CameraState.Preview, CameraState.Captured);
 
-            CameraErrorFactory.ThrowIfError(Native.CancelFocusing(_handle),
-                "Failed to cancel the camera focus.");
+            Native.CancelFocusing(_handle).ThrowIfFailed("Failed to cancel the camera focus.");
         }
 
         /// <summary>
@@ -827,8 +814,9 @@ namespace Tizen.Multimedia
 
                 FaceDetected?.Invoke(this, new FaceDetectedEventArgs(result));
             };
-            CameraErrorFactory.ThrowIfError(Native.StartFaceDetection(_handle, _faceDetectedCallback, IntPtr.Zero),
-                "Failed to start face detection");
+
+            Native.StartFaceDetection(_handle, _faceDetectedCallback, IntPtr.Zero).
+                ThrowIfFailed("Failed to start face detection");
         }
 
         /// <summary>
@@ -848,8 +836,7 @@ namespace Tizen.Multimedia
                 throw new InvalidOperationException("The face detection is not started.");
             }
 
-            CameraErrorFactory.ThrowIfError(Native.StopFaceDetection(_handle),
-                "Failed to stop the face detection.");
+            Native.StopFaceDetection(_handle).ThrowIfFailed("Failed to stop the face detection.");
 
             _faceDetectedCallback = null;
         }
@@ -886,8 +873,9 @@ namespace Tizen.Multimedia
             {
                 InterruptStarted?.Invoke(this, new CameraInterruptStartedEventArgs(policy, state));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetInterruptStartedCallback(_handle, _interruptStartedCallback, IntPtr.Zero),
-                "Failed to set interrupt callback");
+
+            Native.SetInterruptStartedCallback(_handle, _interruptStartedCallback, IntPtr.Zero).
+                ThrowIfFailed("Failed to set interrupt callback");
         }
 
         private void RegisterInterruptedCallback()
@@ -896,8 +884,9 @@ namespace Tizen.Multimedia
             {
                 Interrupted?.Invoke(this, new CameraInterruptedEventArgs(policy, previous, current));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero),
-                "Failed to set interrupt callback");
+
+            Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero).
+                ThrowIfFailed("Failed to set interrupt callback");
         }
 
         private void RegisterErrorCallback()
@@ -906,8 +895,8 @@ namespace Tizen.Multimedia
             {
                 ErrorOccurred?.Invoke(this, new CameraErrorOccurredEventArgs(error, current));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetErrorCallback(_handle, _errorCallback, IntPtr.Zero),
-                "Setting error callback failed");
+
+            Native.SetErrorCallback(_handle, _errorCallback, IntPtr.Zero).ThrowIfFailed("Setting error callback failed");
         }
 
         private void RegisterStateChangedCallback()
@@ -918,8 +907,9 @@ namespace Tizen.Multimedia
                 Log.Info(CameraLog.Tag, "Camera state changed " + previous.ToString() + " -> " + current.ToString());
                 StateChanged?.Invoke(this, new CameraStateChangedEventArgs(previous, current, byPolicy));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero),
-                "Setting state changed callback failed");
+
+            Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero).
+                ThrowIfFailed("Setting state changed callback failed");
         }
 
         private static void RegisterDeviceStateChangedCallback()
@@ -929,16 +919,17 @@ namespace Tizen.Multimedia
                 _deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state));
             };
 
-            CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out _deviceStateCallbackId),
-                "Failed to set device state changed callback");
+            Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out _deviceStateCallbackId).
+                ThrowIfFailed("Failed to set device state changed callback");
 
             Log.Info(CameraLog.Tag, "add callbackId " + _deviceStateCallbackId.ToString());
         }
 
         private static void UnregisterDeviceStateChangedCallback()
         {
-            CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(_deviceStateCallbackId),
-                "Unsetting device state changed callback failed");
+            Native.UnsetDeviceStateChangedCallback(_deviceStateCallbackId).
+                ThrowIfFailed("Unsetting device state changed callback failed");
+
             _deviceStateChangedCallback = null;
             _deviceStateCallbackId = 0;
         }
@@ -949,8 +940,9 @@ namespace Tizen.Multimedia
             {
                 FocusStateChanged?.Invoke(this, new CameraFocusStateChangedEventArgs(state));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetFocusStateChangedCallback(_handle, _focusStateChangedCallback, IntPtr.Zero),
-                "Setting focus changed callback failed");
+
+            Native.SetFocusStateChangedCallback(_handle, _focusStateChangedCallback, IntPtr.Zero).
+                ThrowIfFailed("Setting focus changed callback failed");
         }
 
         private void RegisterHdrCaptureProgress()
@@ -959,14 +951,16 @@ namespace Tizen.Multimedia
             {
                 _hdrCaptureProgress?.Invoke(this, new HdrCaptureProgressEventArgs(percent));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero),
-                "Setting Hdr capture progress callback failed");
+
+            Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero).
+                ThrowIfFailed("Setting Hdr capture progress callback failed");
         }
 
         private void UnregisterHdrCaptureProgress()
         {
-            CameraErrorFactory.ThrowIfError(Native.UnsetHdrCaptureProgressCallback(_handle),
-                "Unsetting hdr capture progress is failed");
+            Native.UnsetHdrCaptureProgressCallback(_handle).
+                ThrowIfFailed("Unsetting hdr capture progress is failed");
+
             _hdrCaptureProgressCallback = null;
         }
 
@@ -976,14 +970,15 @@ namespace Tizen.Multimedia
             {
                 _preview?.Invoke(this, new PreviewEventArgs(new PreviewFrame(frame)));
             };
-            CameraErrorFactory.ThrowIfError(Native.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero),
-                "Setting preview callback failed");
+
+            Native.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero).
+                ThrowIfFailed("Setting preview callback failed");
         }
 
         private void UnregisterPreviewCallback()
         {
-            CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle),
-                "Unsetting preview callback failed");
+            Native.UnsetPreviewCallback(_handle).ThrowIfFailed("Unsetting preview callback failed");
+
             _previewCallback = null;
         }
 
@@ -1002,14 +997,16 @@ namespace Tizen.Multimedia
 
                 packet.Dispose();
             };
-            CameraErrorFactory.ThrowIfError(Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero),
-                "Setting media packet preview callback failed");
+
+            Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero).
+                ThrowIfFailed("Setting media packet preview callback failed");
         }
 
         private void UnregisterMediaPacketPreviewCallback()
         {
-            CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
-                "Unsetting media packet preview callback failed");
+            Native.UnsetMediaPacketPreviewCallback(_handle).
+                ThrowIfFailed("Unsetting media packet preview callback failed");
+
             _mediaPacketPreviewCallback = null;
         }
         #endregion Callback registrations
index 156b570..6c84c48 100644 (file)
@@ -76,8 +76,8 @@ namespace Tizen.Multimedia
 
         private bool CheckRangeValid(GetRangeDelegate func)
         {
-            CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
-                "Failed to check feature is suported or not.");
+            func(_camera.GetHandle(), out int min, out int max).
+                ThrowIfFailed("Failed to check feature is suported or not.");
 
             return min < max;
         }
@@ -557,8 +557,9 @@ namespace Tizen.Multimedia
                 previewResolutions.Add(new Size(width, height));
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
-                "Failed to get the supported preview resolutions");
+
+            NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported preview resolutions");
 
             return previewResolutions.AsReadOnly();
         }
@@ -572,8 +573,9 @@ namespace Tizen.Multimedia
                 cameraResolutions.Add(new Size(width, height));
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
-                "Failed to get the supported capture resolutions");
+
+            NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported capture resolutions");
 
             return cameraResolutions.AsReadOnly();
         }
@@ -587,8 +589,9 @@ namespace Tizen.Multimedia
                 captureFormats.Add(format);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
-                "Failed to get the supported capture formats.");
+
+            NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported capture formats.");
 
             return captureFormats.AsReadOnly();
         }
@@ -602,8 +605,9 @@ namespace Tizen.Multimedia
                 previewFormats.Add(format);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
-                "Failed to get the supported preview formats.");
+
+            NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported preview formats.");
 
             return previewFormats.AsReadOnly();
         }
@@ -617,8 +621,9 @@ namespace Tizen.Multimedia
                 previewFps.Add(fps);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
-                "Failed to get the supported camera fps");
+
+            NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported camera fps");
 
             return previewFps.AsReadOnly();
         }
@@ -632,8 +637,9 @@ namespace Tizen.Multimedia
                 fpsByResolution.Add(fps);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(),
-                width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
+
+            NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(), width, height, callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported fps by resolutions.");
 
             return fpsByResolution.AsReadOnly();
         }
@@ -647,8 +653,9 @@ namespace Tizen.Multimedia
                 autoFocusModes.Add(mode);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported Auto focus modes.");
+
+            NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported Auto focus modes.");
 
             return autoFocusModes.AsReadOnly();
         }
@@ -662,8 +669,9 @@ namespace Tizen.Multimedia
                 exposureModes.Add(mode);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported Exposure modes.");
+
+            NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported Exposure modes.");
 
             return exposureModes.AsReadOnly();
         }
@@ -677,8 +685,9 @@ namespace Tizen.Multimedia
                 isoLevels.Add(iso);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported Iso levels.");
+
+            NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported Iso levels.");
 
             return isoLevels.AsReadOnly();
         }
@@ -692,8 +701,9 @@ namespace Tizen.Multimedia
                 theaterModes.Add(theaterMode);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported theater modes.");
+
+            NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported theater modes.");
 
             return theaterModes.AsReadOnly();
         }
@@ -707,8 +717,9 @@ namespace Tizen.Multimedia
                 whitebalances.Add(whiteBalance);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported white balance.");
+
+            NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported white balance.");
 
             return whitebalances.AsReadOnly();
         }
@@ -722,8 +733,9 @@ namespace Tizen.Multimedia
                 flashModes.Add(flashMode);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported flash modes.");
+
+            NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported flash modes.");
 
             return flashModes.AsReadOnly();
         }
@@ -737,8 +749,9 @@ namespace Tizen.Multimedia
                 sceneModes.Add(sceneMode);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported scene modes.");
+
+            NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported scene modes.");
 
             return sceneModes.AsReadOnly();
         }
@@ -752,8 +765,9 @@ namespace Tizen.Multimedia
                 effectModes.Add(effect);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported camera effects.");
+
+            NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported camera effects.");
 
             return effectModes.AsReadOnly();
         }
@@ -767,8 +781,9 @@ namespace Tizen.Multimedia
                 streamRotations.Add(streamRotation);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported camera rotations.");
+
+            NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported camera rotations.");
 
             return streamRotations.AsReadOnly();
         }
@@ -782,8 +797,9 @@ namespace Tizen.Multimedia
                 streamFlips.Add(streamFlip);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported camera flips.");
+
+            NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported camera flips.");
 
             return streamFlips.AsReadOnly();
         }
@@ -797,8 +813,9 @@ namespace Tizen.Multimedia
                 ptzTypes.Add(ptzType);
                 return true;
             };
-            CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
-            "Failed to get the supported Ptz types.");
+
+            NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero).
+                ThrowIfFailed("Failed to get the supported Ptz types.");
 
             return ptzTypes.AsReadOnly();
         }
old mode 100755 (executable)
new mode 100644 (file)
index 041bb85..4cc3445
@@ -48,8 +48,7 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out var val),
-                    "Failed to get camera display mode");
+                Native.GetMode(_camera.GetHandle(), out var val).ThrowIfFailed("Failed to get camera display mode");
 
                 return val;
             }
@@ -58,8 +57,7 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value),
-                    "Failed to set camera display mode.");
+                Native.SetMode(_camera.GetHandle(), value).ThrowIfFailed("Failed to set camera display mode.");
             }
         }
 
@@ -77,16 +75,14 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val),
-                    "Failed to get visible value");
+                Native.GetVisible(_camera.GetHandle(), out bool val).ThrowIfFailed("Failed to get visible value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value),
-                    "Failed to set display visible.");
+                Native.SetVisible(_camera.GetHandle(), value).ThrowIfFailed("Failed to set display visible.");
             }
         }
 
@@ -104,8 +100,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out var val),
-                    "Failed to get display rotation");
+                Native.GetRotation(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get display rotation");
 
                 return val;
             }
@@ -114,8 +110,7 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value),
-                    "Failed to set display rotation.");
+                Native.SetRotation(_camera.GetHandle(), value).ThrowIfFailed("Failed to set display rotation.");
             }
         }
 
@@ -133,8 +128,7 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
-                    "Failed to get display flip");
+                Native.GetFlip(_camera.GetHandle(), out var val).ThrowIfFailed("Failed to get display flip");
 
                 return val;
             }
@@ -143,8 +137,7 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
 
-                CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
-                    "Failed to set display flip.");
+                Native.SetFlip(_camera.GetHandle(), value).ThrowIfFailed("Failed to set display flip.");
             }
         }
 
@@ -161,16 +154,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(),
-                    out int x, out int y, out int width, out int height), "Failed to get display roi area");
+                Native.GetRoiArea(_camera.GetHandle(), out int x, out int y, out int width, out int height).
+                    ThrowIfFailed("Failed to get display roi area");
 
                 return new Rectangle(x, y, width, height);
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(),
-                    value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");
+                Native.SetRoiArea(_camera.GetHandle(), value.X, value.Y, value.Width, value.Height).
+                    ThrowIfFailed("Failed to set display roi area.");
             }
         }
     }
@@ -40,9 +40,9 @@ namespace Tizen.Multimedia
         ServiceDisconnected = CameraErrorClass | 0x0e
     }
 
-    internal static class CameraErrorFactory
+    internal static class CameraErrorCodeExtensions
     {
-        internal static void ThrowIfError(CameraError errorCode, string errorMessage = null,
+        internal static void ThrowIfFailed(this CameraError errorCode, string errorMessage = null,
             [CallerMemberName] string caller = null, [CallerLineNumber] int line = 0)
         {
             if (errorCode == CameraError.None)
index 1e06426..e106a99 100644 (file)
@@ -54,8 +54,8 @@ namespace Tizen.Multimedia
         private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
         private Range? GetRange(GetRangeDelegate func)
         {
-            CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
-                "Failed to initialize the camera settings");
+            func(_camera.GetHandle(), out int min, out int max).
+                ThrowIfFailed("Failed to initialize the camera settings");
 
             if (min > max)
             {
@@ -81,8 +81,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public void SetAutoFocusArea(int x, int y)
         {
-            CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y),
-                "Failed to set the autofocus area.");
+            Native.SetAutoFocusArea(_camera.GetHandle(), x, y).
+                ThrowIfFailed("Failed to set the autofocus area.");
         }
 
         /// <summary>
@@ -99,8 +99,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public void SetAutoFocusArea(Point pos)
         {
-            CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y),
-                "Failed to set the autofocus area.");
+            Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y).
+                ThrowIfFailed("Failed to set the autofocus area.");
         }
 
         /// <summary>
@@ -111,8 +111,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public void ClearFocusArea()
         {
-            CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()),
-                "Failed to clear the autofocus area.");
+            Native.ClearAutoFocusArea(_camera.GetHandle()).
+                ThrowIfFailed("Failed to clear the autofocus area.");
         }
 
         /// <summary>
@@ -127,8 +127,8 @@ namespace Tizen.Multimedia
             {
                 CameraAutoFocusMode val = CameraAutoFocusMode.None;
 
-                CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val),
-                    "Failed to get camera autofocus mode");
+                Native.GetAutoFocusMode(_camera.GetHandle(), out val).
+                    ThrowIfFailed("Failed to get camera autofocus mode");
 
                 return val;
             }
@@ -137,8 +137,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value),
-                    "Failed to set camera autofocus mode.");
+                Native.SetAutoFocusMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera autofocus mode.");
             }
         }
         #endregion Auto Focus
@@ -153,16 +153,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out int val),
-                    "Failed to get camera contrast value");
+                Native.GetContrast(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get camera contrast value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value),
-                    "Failed to set camera contrast value.");
+                Native.SetContrast(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera contrast value.");
             }
         }
 
@@ -176,16 +176,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val),
-                    "Failed to get camera auto contrast");
+                Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val).
+                    ThrowIfFailed("Failed to get camera auto contrast");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value),
-                    "Failed to set camera enable auto contrast.");
+                Native.EnableAutoContrast(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera enable auto contrast.");
             }
         }
 
@@ -221,16 +221,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetHue(_camera.GetHandle(), out int val),
-                    "Failed to get camera hue value");
+                Native.GetHue(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get camera hue value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetHue(_camera.GetHandle(), value),
-                    "Failed to set camera hue value.");
+                Native.SetHue(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera hue value.");
             }
         }
 
@@ -267,16 +267,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out int val),
-                    "Failed to get camera brightness value");
+                Native.GetBrightness(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get camera brightness value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value),
-                    "Failed to set camera brightness value.");
+                Native.SetBrightness(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera brightness value.");
             }
         }
 
@@ -312,16 +312,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out int val),
-                    "Failed to get camera exposure value");
+                Native.GetExposure(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get camera exposure value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value),
-                    "Failed to set camera exposure value.");
+                Native.SetExposure(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera exposure value.");
             }
         }
 
@@ -337,8 +337,8 @@ namespace Tizen.Multimedia
             {
                 CameraExposureMode val = CameraExposureMode.Off;
 
-                CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val),
-                    "Failed to get camera exposure mode");
+                Native.GetExposureMode(_camera.GetHandle(), out val).
+                    ThrowIfFailed("Failed to get camera exposure mode");
 
                 return val;
             }
@@ -347,8 +347,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value),
-                    "Failed to set camera exposure mode.");
+                Native.SetExposureMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera exposure mode.");
             }
         }
 
@@ -385,16 +385,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out int val),
-                    "Failed to get zoom level");
+                Native.GetZoom(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get zoom level");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), value),
-                    "Failed to set zoom level.");
+                Native.SetZoom(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set zoom level.");
             }
         }
 
@@ -432,8 +432,8 @@ namespace Tizen.Multimedia
             {
                 CameraWhiteBalance val = CameraWhiteBalance.None;
 
-                CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val),
-                    "Failed to get camera whitebalance");
+                Native.GetWhiteBalance(_camera.GetHandle(), out val).
+                    ThrowIfFailed("Failed to get camera whitebalance");
 
                 return val;
             }
@@ -442,8 +442,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value),
-                    "Failed to set camera whitebalance.");
+                Native.SetWhitebalance(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera whitebalance.");
             }
         }
 
@@ -459,8 +459,8 @@ namespace Tizen.Multimedia
             {
                 CameraIsoLevel val = CameraIsoLevel.Auto;
 
-                CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val),
-                    "Failed to get camera Iso level");
+                Native.GetIso(_camera.GetHandle(), out val).
+                    ThrowIfFailed("Failed to get camera Iso level");
 
                 return val;
             }
@@ -469,8 +469,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value),
-                    "Failed to set camera Iso level.");
+                Native.SetIso(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera Iso level.");
             }
         }
 
@@ -484,8 +484,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out int val),
-                    "Failed to get image quality");
+                Native.GetImageQuality(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get image quality");
 
                 return val;
             }
@@ -497,8 +497,8 @@ namespace Tizen.Multimedia
                     throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)");
                 }
 
-                CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value),
-                    "Failed to set image quality.");
+                Native.SetImageQuality(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set image quality.");
             }
         }
 
@@ -513,8 +513,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out var val),
-                    "Failed to get camera preview fps");
+                Native.GetPreviewFps(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera preview fps");
 
                 return val;
             }
@@ -523,8 +523,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraFps), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value),
-                    "Failed to set preview fps.");
+                Native.SetPreviewFps(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set preview fps.");
             }
         }
 
@@ -538,16 +538,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out int width, out int height),
-                    "Failed to get camera preview resolution");
+                GetPreviewResolution(_camera.GetHandle(), out int width, out int height).
+                    ThrowIfFailed("Failed to get camera preview resolution");
 
                 return new Size(width, height);
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height),
-                    "Failed to set preview resolution.");
+                SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height).
+                    ThrowIfFailed("Failed to set preview resolution.");
             }
         }
 
@@ -564,8 +564,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height),
-                    "Failed to get recommended preview resolution");
+                GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height).
+                    ThrowIfFailed("Failed to get recommended preview resolution");
 
                 return new Size(width, height);
             }
@@ -582,8 +582,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out var val),
-                    "Failed to get preview format");
+                GetPreviewPixelFormat(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get preview format");
 
                 return val;
             }
@@ -592,8 +592,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value),
-                    "Failed to set preview format.");
+                SetPreviewPixelFormat(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set preview format.");
             }
         }
 
@@ -607,8 +607,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out int width, out int height),
-                    "Failed to get camera capture resolution");
+                GetCaptureResolution(_camera.GetHandle(), out int width, out int height).
+                    ThrowIfFailed("Failed to get camera capture resolution");
 
                 return new Size(width, height);
             }
@@ -617,8 +617,8 @@ namespace Tizen.Multimedia
             {
                 Size res = value;
 
-                CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height),
-                    "Failed to set capture resolution.");
+                SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height).
+                    ThrowIfFailed("Failed to set capture resolution.");
             }
         }
 
@@ -633,8 +633,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out var val),
-                    "Failed to get camera capture formats");
+                GetCaptureFormat(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera capture formats");
 
                 return val;
             }
@@ -643,8 +643,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value),
-                    "Failed to set capture format.");
+                SetCaptureFormat(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set capture format.");
             }
         }
         #endregion Resolution, Format, Fps of preview, capture
@@ -659,16 +659,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out int val),
-                    "Failed to get preview bitrate");
+                Native.GetBitrate(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get preview bitrate");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), value),
-                    "Failed to set encoded preview bitrate.");
+                Native.SetBitrate(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set encoded preview bitrate.");
             }
         }
 
@@ -681,16 +681,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out int val),
-                    "Failed to get preview gop interval");
+                Native.GetGopInterval(_camera.GetHandle(), out int val).
+                    ThrowIfFailed("Failed to get preview gop interval");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), value),
-                    "Failed to set encoded preview gop intervals.");
+                Native.SetGopInterval(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set encoded preview gop intervals.");
             }
         }
         #endregion Encoded preview
@@ -709,8 +709,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out var val),
-                    "Failed to get camera theater mode");
+                Native.GetTheaterMode(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera theater mode");
 
                 return val;
             }
@@ -719,8 +719,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value),
-                    "Failed to set camera theater mode.");
+                Native.SetTheaterMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera theater mode.");
             }
         }
 
@@ -734,8 +734,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out var val),
-                    "Failed to get camera effect");
+                Native.GetEffect(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera effect");
 
                 return val;
             }
@@ -744,8 +744,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value),
-                    "Failed to set camera effect.");
+                Native.SetEffect(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera effect.");
             }
         }
 
@@ -759,8 +759,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out var val),
-                    "Failed to get camera scene mode");
+                Native.GetSceneMode(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera scene mode");
 
                 return val;
             }
@@ -769,8 +769,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value),
-                    "Failed to set camera scene mode.");
+                Native.SetSceneMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera scene mode.");
             }
         }
 
@@ -784,8 +784,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out var val),
-                    "Failed to get camera flash mode");
+                Native.GetFlashMode(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera flash mode");
 
                 return val;
             }
@@ -794,8 +794,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value),
-                    "Failed to set camera flash mode.");
+                Native.SetFlashMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera flash mode.");
             }
         }
 
@@ -808,8 +808,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out var val),
-                    "Failed to get camera lens orientation");
+                Native.GetLensOrientation(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera lens orientation");
 
                 return val;
             }
@@ -825,8 +825,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out var val),
-                    "Failed to get camera stream rotation");
+                Native.GetStreamRotation(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera stream rotation");
 
                 return val;
             }
@@ -835,8 +835,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value),
-                    "Failed to set camera stream rotation.");
+                Native.SetStreamRotation(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera stream rotation.");
             }
         }
 
@@ -850,8 +850,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val),
-                    "Failed to get camera stream flip");
+                Native.GetFlip(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera stream flip");
 
                 return val;
             }
@@ -860,8 +860,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips));
 
-                CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value),
-                    "Failed to set camera flip.");
+                Native.SetFlip(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera flip.");
             }
         }
 
@@ -880,8 +880,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out var val),
-                    "Failed to get camera hdr mode");
+                Native.GetHdrMode(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera hdr mode");
 
                 return val;
             }
@@ -890,8 +890,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value),
-                    "Failed to set camera hdr mode.");
+                Native.SetHdrMode(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera hdr mode.");
             }
         }
 
@@ -905,16 +905,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val),
-                    "Failed to get camera anti shake value");
+                Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val).
+                    ThrowIfFailed("Failed to get camera anti shake value");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value),
-                    "Failed to set camera anti shake value.");
+                Native.EnableAntiShake(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera anti shake value.");
             }
         }
 
@@ -932,16 +932,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val),
-                    "Failed to get camera video stabilization");
+                Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val).
+                    ThrowIfFailed("Failed to get camera video stabilization");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value),
-                    "Failed to set camera video stabilization.");
+                Native.EnableVideoStabilization(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera video stabilization.");
             }
         }
 
@@ -959,8 +959,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public void DisableShutterSound(bool shutterSound)
         {
-            CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), shutterSound),
-                    "Failed to set disable shutter sound.");
+            Native.DisableShutterSound(_camera.GetHandle(), shutterSound).
+                ThrowIfFailed("Failed to set disable shutter sound.");
         }
 
         #region PTZ(Pan Tilt Zoom), Pan, Tilt
@@ -976,8 +976,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraPtzType), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value),
-                    "Failed to set camera ptz type.");
+                Native.SetPtzType(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera ptz type.");
             }
         }
 
@@ -994,8 +994,8 @@ namespace Tizen.Multimedia
         {
             ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
 
-            CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep),
-                "Failed to set the camera pan type.");
+            Native.SetPan(_camera.GetHandle(), type, panStep).
+                ThrowIfFailed("Failed to set the camera pan type.");
         }
 
         /// <summary>
@@ -1007,8 +1007,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public int GetPan()
         {
-            CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out int val),
-                "Failed to get the camera pan step.");
+            Native.GetPan(_camera.GetHandle(), out int val).
+                ThrowIfFailed("Failed to get the camera pan step.");
 
             return val;
         }
@@ -1025,8 +1025,9 @@ namespace Tizen.Multimedia
         public void SetTilt(CameraPtzMoveType type, int tiltStep)
         {
             ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type));
-            CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep),
-                "Failed to set the camera tilt type\t.");
+
+            Native.SetTilt(_camera.GetHandle(), type, tiltStep).
+                ThrowIfFailed("Failed to set the camera tilt type\t.");
         }
 
         /// <summary>
@@ -1038,8 +1039,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public int GetTilt()
         {
-            CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out int val),
-                "Failed to set the camera current position.");
+            Native.GetTilt(_camera.GetHandle(), out int val).
+                ThrowIfFailed("Failed to set the camera current position.");
 
             return val;
         }
@@ -1098,16 +1099,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out bool val),
-                    "Failed to get camera enable tag");
+                Native.IsEnabledTag(_camera.GetHandle(), out bool val).
+                    ThrowIfFailed("Failed to get camera enable tag");
 
                 return val;
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value),
-                    "Failed to set camera enable tag.");
+                Native.EnableTag(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera enable tag.");
             }
         }
 
@@ -1123,8 +1124,8 @@ namespace Tizen.Multimedia
                 IntPtr val = IntPtr.Zero;
                 try
                 {
-                    CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val),
-                    "Failed to get image description");
+                    Native.GetImageDescription(_camera.GetHandle(), out val).
+                        ThrowIfFailed("Failed to get image description");
 
                     return Marshal.PtrToStringAnsi(val);
                 }
@@ -1136,8 +1137,8 @@ namespace Tizen.Multimedia
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value),
-                    "Failed to set image description.");
+                Native.SetImageDescription(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set image description.");
             }
         }
 
@@ -1154,8 +1155,8 @@ namespace Tizen.Multimedia
 
                 try
                 {
-                    CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val),
-                    "Failed to get tag software");
+                    Native.GetTagSoftware(_camera.GetHandle(), out val).
+                        ThrowIfFailed("Failed to get tag software");
 
                     return Marshal.PtrToStringAnsi(val);
                 }
@@ -1167,8 +1168,8 @@ namespace Tizen.Multimedia
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value),
-                    "Failed to set tag software.");
+                Native.SetTagSoftware(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set tag software.");
             }
         }
 
@@ -1181,16 +1182,16 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(),
-                    out double latitude, out double longitude, out double altitude), "Failed to get tag");
+                Native.GetGeotag(_camera.GetHandle(), out double latitude, out double longitude, out double altitude).
+                    ThrowIfFailed("Failed to get tag");
 
                 return new Location(latitude, longitude, altitude);
             }
 
             set
             {
-                CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(),
-                    value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag.");
+                Native.SetGeotag(_camera.GetHandle(), value.Latitude, value.Longitude, value.Altitude).
+                    ThrowIfFailed("Failed to set geo tag.");
             }
         }
 
@@ -1202,8 +1203,8 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The camera already has been disposed of.</exception>
         public void RemoveGeoTag()
         {
-            CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()),
-                "Failed to remove the geotag\t.");
+            Native.RemoveGeotag(_camera.GetHandle()).
+                ThrowIfFailed("Failed to remove the geotag.");
         }
 
         /// <summary>
@@ -1215,8 +1216,8 @@ namespace Tizen.Multimedia
         {
             get
             {
-                CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out var val),
-                    "Failed to get camera tag orientation");
+                Native.GetTagOrientation(_camera.GetHandle(), out var val).
+                    ThrowIfFailed("Failed to get camera tag orientation");
 
                 return val;
             }
@@ -1225,8 +1226,8 @@ namespace Tizen.Multimedia
             {
                 ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value, nameof(value));
 
-                CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value),
-                    "Failed to set camera tag orientation.");
+                Native.SetTagOrientation(_camera.GetHandle(), value).
+                    ThrowIfFailed("Failed to set camera tag orientation.");
             }
         }
         #endregion EXIF tag