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.
18 using static Interop.VoiceControl;
20 namespace Tizen.Uix.VoiceControl
22 internal static class ExceptionFactory
24 internal static Exception CreateException(ErrorCode err)
26 Tizen.Log.Error(LogTag, "Error " + err);
30 case ErrorCode.OutOfMemory:
32 exp = new OutOfMemoryException("Out Of Memory");
36 case ErrorCode.IoError:
38 exp = new InvalidOperationException("I/O Error Occured");
42 case ErrorCode.InvalidParameter:
44 exp = new ArgumentException("Invalid Parameters Provided");
48 case ErrorCode.TimedOut:
50 exp = new TimeoutException("No answer from service");
54 case ErrorCode.RecorderBusy:
56 exp = new InvalidOperationException("Recorder is Busy ");
60 case ErrorCode.PermissionDenied:
62 exp = new UnauthorizedAccessException("Permission Denied");
66 case ErrorCode.NotSupported:
68 exp = new NotSupportedException("VC NOT supported");
72 case ErrorCode.InvalidState:
74 exp = new InvalidOperationException("Invalid state");
78 case ErrorCode.InvalidLanguage:
80 exp = new InvalidOperationException("Invalid language");
84 case ErrorCode.EngineNotFound:
86 exp = new InvalidOperationException("No available engine");
90 case ErrorCode.OperationFailed:
92 exp = new InvalidOperationException("Operation Failed");
96 case ErrorCode.OperationRejected:
98 exp = new InvalidOperationException("Operation Rejected");
102 case ErrorCode.IterationEnd:
104 exp = new InvalidOperationException("List Reached End");
108 case ErrorCode.Empty:
110 exp = new InvalidOperationException("List Empty");
114 case ErrorCode.InProgressToReady:
116 exp = new InvalidOperationException("Progress to ready is not finished");
120 case ErrorCode.InProgressToRecording:
122 exp = new InvalidOperationException("Progress to recording is not finished");
126 case ErrorCode.InProgressToProcessing:
128 exp = new InvalidOperationException("Progress to processing is not finished");
132 case ErrorCode.ServiceReset:
134 exp = new InvalidOperationException("Service reset");
140 exp = new Exception("");