2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using Tizen.Internals.Errors;
21 namespace Tizen.Multimedia.Vision
23 internal static class MediaVisionLog
25 internal const string Tag = "Tizen.Multimedia.MediaVision";
29 /// Enumeration for media vision's error codes.
31 internal enum MediaVisionError
33 MediaVisionErrorCode = -0x019D0000,
37 None = ErrorCode.None,
41 NotSupported = ErrorCode.NotSupported,
45 MsgTooLong = ErrorCode.MsgTooLong,
49 NoData = ErrorCode.NoData,
51 /// Key not available.
53 KeyNotAvailable = ErrorCode.KeyNotAvailable,
57 OutOfMemory = ErrorCode.OutOfMemory,
59 /// Invalid parameter.
61 InvalidParameter = ErrorCode.InvalidParameter,
63 /// Invalid operation.
65 InvalidOperation = ErrorCode.InvalidOperation,
67 /// Permission denied.
69 PermissionDenied = ErrorCode.NotPermitted,
71 /// Not supported format.
73 NotSupportedFormat = MediaVisionErrorCode | 0x01,
77 Internal = MediaVisionErrorCode | 0x02,
81 InvalidData = MediaVisionErrorCode | 0x03,
83 /// Invalid path (Since 3.0).
85 InvalidPath = MediaVisionErrorCode | 0x04
88 internal static class MediaVisionErrorExtensions
90 public static void Validate(this MediaVisionError error, string msg)
92 if (error == MediaVisionError.None)
99 case MediaVisionError.NotSupported:
100 throw new NotSupportedException(msg);
101 case MediaVisionError.MsgTooLong:
102 throw new ArgumentException($"{msg} : Message too long.");
103 case MediaVisionError.NoData:
104 throw new InvalidOperationException($"{msg} : No Data.");
105 case MediaVisionError.KeyNotAvailable:
106 throw new ArgumentException($"{msg} : Key Not Available.");
107 case MediaVisionError.OutOfMemory:
108 throw new OutOfMemoryException($"{msg} : Out of Memory.");
109 case MediaVisionError.InvalidParameter:
110 throw new ArgumentException($"{msg} : Invalid argument.");
111 case MediaVisionError.InvalidOperation:
112 throw new InvalidOperationException($"{msg} : Invalid Operation.");
113 case MediaVisionError.PermissionDenied:
114 throw new UnauthorizedAccessException($"{msg} : Permission Denied.");
115 case MediaVisionError.NotSupportedFormat:
116 throw new NotSupportedException($"{msg} : Not Supported Format.");
117 case MediaVisionError.Internal:
118 throw new InvalidOperationException($"{msg} : Internal Error.");
119 case MediaVisionError.InvalidData:
120 throw new ArgumentException($"{msg} : Invalid Data.");
121 case MediaVisionError.InvalidPath:
122 throw new FileNotFoundException($"{msg} : Invalid Path.");
124 throw new InvalidOperationException($"{msg} : Unknown Error.");