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 namespace Tizen.Network.Nsd
21 internal static class NsdErrorFactory
23 internal static void ThrowDnssdException(int exception)
25 DnssdError _error = (DnssdError)exception;
28 case DnssdError.OutOfMemory:
29 throw new InvalidOperationException("Out of memory");
30 case DnssdError.PermissionDenied:
31 throw new UnauthorizedAccessException("Permission Denied");
32 case DnssdError.InvalidOperation:
33 throw new InvalidOperationException("Invalid operation");
34 case DnssdError.InvalidParameter:
35 throw new ArgumentException("Invalid parameter");
36 case DnssdError.NotSupported:
37 throw new NotSupportedException("Not supported");
38 case DnssdError.NotInitialized:
39 throw new InvalidOperationException("Not initialized");
40 case DnssdError.AlreadyRegistered:
41 throw new InvalidOperationException("Already registered");
42 case DnssdError.NameConflict:
43 throw new InvalidOperationException("Name conflict");
44 case DnssdError.ServiceNotRunning:
45 throw new InvalidOperationException("Service not running");
46 case DnssdError.ServiceNotFound:
47 throw new InvalidOperationException("Service not found");
48 case DnssdError.OperationFailed:
49 throw new InvalidOperationException("Operation failed");
53 internal static void ThrowSsdpException(int exception)
55 SsdpError _error = (SsdpError)exception;
58 case SsdpError.OutOfMemory:
59 throw new InvalidOperationException("Out of memory");
60 case SsdpError.PermissionDenied:
61 throw new UnauthorizedAccessException("Permission Denied");
62 case SsdpError.InvalidParameter:
63 throw new ArgumentException("Invalid parameter");
64 case SsdpError.NotSupported:
65 throw new NotSupportedException("Not supported");
66 case SsdpError.NotInitialized:
67 throw new InvalidOperationException("Not initialized");
68 case SsdpError.OperationFailed:
69 throw new InvalidOperationException("Operation failed");
70 case SsdpError.ServiceNotFound:
71 throw new InvalidOperationException("Service not found");
72 case SsdpError.ServiceAlreadyRegistered:
73 throw new InvalidOperationException("Service already registered");