Change assembly installation path
[platform/core/csapi/system-settings.git] / Tizen.System.SystemSettings / Tizen.System.SystemSettings / SystemSettingsExceptionFactory.cs
1 using System;
2
3 namespace Tizen.System.SystemSettings
4 {
5     internal enum SystemSettingsError
6     {
7         None = Tizen.Internals.Errors.ErrorCode.None,
8         InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
9         OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
10         IoError = Tizen.Internals.Errors.ErrorCode.IoError,
11         PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
12         NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
13         LockScreenAppPasswordMode = -0x01140000 | 0x01
14     };
15     internal class SystemSettingsExceptionFactory
16     {
17         internal const string LogTag = "Tizen.System.SystemSettings";
18
19         internal static Exception CreateException(SystemSettingsError err, string msg)
20         {
21             Exception exp;
22             switch (err)
23             {
24                 case SystemSettingsError.InvalidParameter:
25                     exp = new ArgumentException(msg);
26                     break;
27                 case SystemSettingsError.OutOfMemory:
28                 //fall through
29                 case SystemSettingsError.IoError:
30                 //fall through
31                 case SystemSettingsError.PermissionDenied:
32                 //fall through
33                 case SystemSettingsError.NotSupported:
34                 //fall through
35                 case SystemSettingsError.LockScreenAppPasswordMode:
36                 //fall through
37                 default:
38                     exp = new InvalidOperationException(msg);
39                     break;
40             }
41             return exp;
42         }
43     }
44 }