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.Applications
21 internal enum AlarmError
23 None = Tizen.Internals.Errors.ErrorCode.None,
24 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
25 InvalidTime = -0x01100000 | 0x05,
26 InvalidDate = -0x01100000 | 0x06,
27 ConnectionFail = -0x01100000 | 0x07,
28 NotPermittedApp = -0x01100000 | 0x08,
29 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
30 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied
32 internal static class AlarmErrorFactory
34 private const string _logTag = "Tizen.Applications.Alarm";
36 internal static Exception GetException(AlarmError ret, string msg)
40 case AlarmError.InvalidParameter:
42 case AlarmError.InvalidTime:
44 case AlarmError.InvalidDate:
45 Log.Error(_logTag, msg);
46 return new ArgumentException(ret + " error occurred.");
47 case AlarmError.NotPermittedApp:
49 case AlarmError.PermissionDenied:
50 Log.Error(_logTag, msg);
51 return new UnauthorizedAccessException(ret + "error occured.");
53 Log.Error(_logTag, msg);
54 return new InvalidOperationException(ret + " error occurred.");