[NUI] Change SelectionChangedEventArgs to TextSelectionChangedEventArgs (#3451)
[platform/core/csapi/tizenfx.git] / src / Tizen.Uix.VoiceControl / Tizen.Uix.VoiceControl / ExceptionFactory.cs
1 /*
2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 using System;
18 using static Interop.VoiceControl;
19
20 namespace Tizen.Uix.VoiceControl
21 {
22     internal static class ExceptionFactory
23     {
24         internal static Exception CreateException(ErrorCode err)
25         {
26             Tizen.Log.Error(LogTag, "Error " + err);
27             Exception exp;
28             switch (err)
29             {
30                 case ErrorCode.OutOfMemory:
31                     {
32                         exp = new OutOfMemoryException("Out Of Memory");
33                         break;
34                     }
35
36                 case ErrorCode.IoError:
37                     {
38                         exp = new InvalidOperationException("I/O Error Occured");
39                         break;
40                     }
41
42                 case ErrorCode.InvalidParameter:
43                     {
44                         exp = new ArgumentException("Invalid Parameters Provided");
45                         break;
46                     }
47
48                 case ErrorCode.TimedOut:
49                     {
50                         exp = new TimeoutException("No answer from service");
51                         break;
52                     }
53
54                 case ErrorCode.RecorderBusy:
55                     {
56                         exp = new InvalidOperationException("Recorder is Busy ");
57                         break;
58                     }
59
60                 case ErrorCode.PermissionDenied:
61                     {
62                         exp = new UnauthorizedAccessException("Permission Denied");
63                         break;
64                     }
65
66                 case ErrorCode.NotSupported:
67                     {
68                         exp = new NotSupportedException("VC NOT supported");
69                         break;
70                     }
71
72                 case ErrorCode.InvalidState:
73                     {
74                         exp = new InvalidOperationException("Invalid state");
75                         break;
76                     }
77
78                 case ErrorCode.InvalidLanguage:
79                     {
80                         exp = new InvalidOperationException("Invalid language");
81                         break;
82                     }
83
84                 case ErrorCode.EngineNotFound:
85                     {
86                         exp = new InvalidOperationException("No available engine");
87                         break;
88                     }
89
90                 case ErrorCode.OperationFailed:
91                     {
92                         exp = new InvalidOperationException("Operation Failed");
93                         break;
94                     }
95
96                 case ErrorCode.OperationRejected:
97                     {
98                         exp = new InvalidOperationException("Operation Rejected");
99                         break;
100                     }
101
102                 case ErrorCode.IterationEnd:
103                     {
104                         exp = new InvalidOperationException("List Reached End");
105                         break;
106                     }
107
108                 case ErrorCode.Empty:
109                     {
110                         exp = new InvalidOperationException("List Empty");
111                         break;
112                     }
113
114                 case ErrorCode.InProgressToReady:
115                     {
116                         exp = new InvalidOperationException("Progress to ready is not finished");
117                         break;
118                     }
119
120                 case ErrorCode.InProgressToRecording:
121                     {
122                         exp = new InvalidOperationException("Progress to recording is not finished");
123                         break;
124                     }
125
126                 case ErrorCode.InProgressToProcessing:
127                     {
128                         exp = new InvalidOperationException("Progress to processing is not finished");
129                         break;
130                     }
131
132                 case ErrorCode.ServiceReset:
133                     {
134                         exp = new InvalidOperationException("Service reset");
135                         break;
136                     }
137
138                 default:
139                     {
140                         exp = new Exception("");
141                         break;
142                     }
143             }
144
145             return exp;
146         }
147     }
148 }