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.ComponentModel;
19 using Tizen.Internals.Errors;
21 namespace Tizen.System
23 [EditorBrowsable(EditorBrowsableState.Never)]
24 internal enum RuntimeInfoError
26 None = ErrorCode.None,
27 InvalidParameter = ErrorCode.InvalidParameter,
28 OutOfMemory = ErrorCode.OutOfMemory,
29 Io = ErrorCode.IoError,
30 RemoteIo = ErrorCode.RemoteIo,
31 PermissionDenied = ErrorCode.PermissionDenied,
32 NotSupported = ErrorCode.NotSupported,
33 NoData = ErrorCode.NoData
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 internal static class RuntimeInfoErrorFactory
39 internal const string LogTag = "Tizen.System.RuntimeInformation";
41 internal static void ThrowException(int err)
43 RuntimeInfoError error = (RuntimeInfoError)err;
44 if (error == RuntimeInfoError.InvalidParameter)
46 throw new ArgumentException("Invalid parameter");
48 else if (error == RuntimeInfoError.OutOfMemory)
50 throw new OutOfMemoryException("Out of memory");
52 else if (error == RuntimeInfoError.Io)
54 throw new ArgumentException("I/O Error");
56 else if (error == RuntimeInfoError.RemoteIo)
58 throw new ArgumentException("Remote I/O Error");
60 else if (error == RuntimeInfoError.PermissionDenied)
62 throw new UnauthorizedAccessException("Permission denied");
64 else if (error == RuntimeInfoError.NotSupported)
66 throw new NotSupportedException("Not supported");
68 else if (error == RuntimeInfoError.NoData)
70 throw new NotSupportedException("No data");