fixup! Reset dump values when pause function is called
[platform/core/api/audio-io.git] / include / CAudioError.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
19
20
21 #ifdef __cplusplus
22
23 #include <exception>
24 #include <stdexcept>
25 #include <string>
26
27 namespace tizen_media_audio {
28     /**
29      * Audio Error
30      */
31 class CAudioError : public std::exception {
32     public:
33         enum class EError : unsigned int {
34             ERROR_NONE,
35
36             ERROR_INVALID_ARGUMENT,
37             ERROR_INVALID_HANDLE,
38             ERROR_INVALID_POINTER,
39             ERROR_INVALID_OPERATION,
40             ERROR_INVALID_STATE,
41
42             ERROR_NOT_INITIALIZED,
43             ERROR_NOT_SUPPORTED,
44             ERROR_NOT_SUPPORTED_TYPE,
45
46             ERROR_PERMISSION_DENIED,
47
48             ERROR_DEVICE_POLICY_RESTRICTION,
49             ERROR_DEVICE_NOT_OPENED,
50             ERROR_DEVICE_NOT_CLOSED,
51
52             ERROR_OUT_OF_MEMORY,
53             ERROR_INTERNAL_OPERATION,
54             ERROR_FAILED_OPERATION,
55
56             ERROR_POLICY_BLOCKED,
57             ERROR_POLICY_INTERRUPTED,
58             ERROR_POLICY_DUPLICATED,
59
60             ERROR_MAX
61         };
62
63         static constexpr auto MSG_LENGTH = 512;
64         CAudioError(EError err, const char* msg, const char* file, const char* func, int line);
65
66         const char *what() const noexcept override;
67         const char* getErrorMsg() const noexcept;
68         EError getError() const noexcept;
69
70 private:
71         static const char* __convertErrorToString(EError err) noexcept;
72
73         EError __mError;
74         std::runtime_error __mFullMsg;
75     };
76
77
78 } /* namespace tizen_media_audio */
79
80 #endif
81 #endif /* __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__ */