2 * Copyright (c) 2017 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 Tizen.Internals.Errors;
20 namespace Tizen.Context.AppHistory
22 internal enum AppHistoryError
24 None = ErrorCode.None,
25 InvalidParameter = ErrorCode.InvalidParameter,
26 OutOfMemory = ErrorCode.OutOfMemory,
27 PermissionDenied = ErrorCode.PermissionDenied,
28 NotSupported = ErrorCode.NotSupported,
29 NoData = ErrorCode.NoData,
30 OperationFailed = -0x02480000 | 0x04,
33 internal static class AppHistoryErrorFactory
35 internal const string LogTag = "Tizen.Context.AppHistory";
37 internal static Exception CheckAndThrowException(AppHistoryError error, string msg)
41 case AppHistoryError.None:
43 case AppHistoryError.InvalidParameter:
44 return new ArgumentException("Invalid Parameter: " + msg);
45 case AppHistoryError.OutOfMemory:
46 return new OutOfMemoryException("Out of Memory: " + msg);
47 case AppHistoryError.PermissionDenied:
48 return new UnauthorizedAccessException("Permission Denied: " + msg);
49 case AppHistoryError.NotSupported:
50 return new NotSupportedException("Not Supported: " + msg);
51 case AppHistoryError.OperationFailed:
52 return new InvalidOperationException("Operation Failed: " + msg);
54 return new InvalidOperationException("Unknown Error Code: " + msg);