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 Tizen.Internals.Errors;
20 namespace Tizen.Multimedia
22 internal enum AudioManagerError
24 SoundManagerError = -0x01960000,
28 None = ErrorCode.None,
32 OutOfMemory = ErrorCode.OutOfMemory,
36 InvalidParameter = ErrorCode.InvalidParameter,
40 InvalidOperation = ErrorCode.InvalidOperation,
44 PermissionDenied = ErrorCode.PermissionDenied,
48 NotSupported = ErrorCode.NotSupported,
52 NoData = ErrorCode.NoData,
54 /// Internal error inside the sound system
56 Internal = SoundManagerError | 01,
58 /// Noncompliance with the sound system policy
60 Policy = SoundManagerError | 02,
64 NoPlayingSound = SoundManagerError | 03,
66 /// Invalid state (Since 3.0)
68 InvalidState = SoundManagerError | 04
71 internal static class AudioManagerErrorExtensions
73 internal static void Validate(this AudioManagerError err, string msg)
75 if (err == AudioManagerError.None)
85 case AudioManagerError.OutOfMemory:
86 throw new OutOfMemoryException(msg);
88 case AudioManagerError.InvalidParameter:
89 throw new ArgumentException(msg);
91 case AudioManagerError.PermissionDenied:
92 throw new UnauthorizedAccessException(msg);
94 case AudioManagerError.NotSupported:
95 throw new NotSupportedException(msg);
97 case AudioManagerError.Policy:
98 throw new AudioPolicyException(msg);
100 case AudioManagerError.NoData:
101 // TODO check when it is thrown
102 throw new InvalidOperationException(msg);
104 case AudioManagerError.Internal:
105 case AudioManagerError.InvalidOperation:
106 case AudioManagerError.NoPlayingSound:
107 case AudioManagerError.InvalidState:
108 throw new InvalidOperationException(msg);
111 throw new InvalidOperationException("Unknown Error : " + msg);