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 System.Collections.Generic;
21 using System.Threading.Tasks;
23 namespace Tizen.Network.Connection
25 internal class ConnectionErrorFactory
27 static public void ThrowConnectionException(int errno)
29 ConnectionError error = (ConnectionError)errno;
30 if (error == ConnectionError.AddressFamilyNotSupported)
32 throw new InvalidOperationException("Address Family Not Supported");
34 else if (error == ConnectionError.AlreadyExists)
36 throw new InvalidOperationException("Already Exists");
38 else if (error == ConnectionError.DhcpFailed)
40 throw new InvalidOperationException("DHCP Failed");
42 else if (error == ConnectionError.EndOfIteration)
44 throw new InvalidOperationException("End Of Iteration");
46 else if (error == ConnectionError.InvalidKey)
48 throw new InvalidOperationException("Invalid Key");
50 else if (error == ConnectionError.InvalidOperation)
52 throw new InvalidOperationException("Invalid Operation");
54 else if (error == ConnectionError.InvalidParameter)
56 throw new InvalidOperationException("Invalid Parameter");
58 else if (error == ConnectionError.NoConnection)
60 throw new InvalidOperationException("No Connection");
62 else if (error == ConnectionError.NoReply)
64 throw new InvalidOperationException("No Reply");
66 else if (error == ConnectionError.NotSupported)
68 throw new NotSupportedException("Not Supported");
70 else if (error == ConnectionError.NowInProgress)
72 throw new InvalidOperationException("Now In Progress");
74 else if (error == ConnectionError.OperationAborted)
76 throw new InvalidOperationException("Operation Aborted");
78 else if (error == ConnectionError.OperationFailed)
80 throw new InvalidOperationException("Operation Failed");
82 else if (error == ConnectionError.OutOfMemoryError)
84 throw new InvalidOperationException("Out Of Memory Error");
86 else if (error == ConnectionError.PermissionDenied)
88 throw new InvalidOperationException("Permission Denied");