2 * Copyright (c) 2015 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 #include "CAudioIODef.h"
22 using namespace tizen_media_audio;
27 CAudioError::CAudioError(EError err, const char* msg, const char* file, const char* func, int line) :
30 ostringstream stringStream;
32 stringStream << "[ " << __convertErrorToString(__mError)
33 << " | "<< file << ": " << func << "(" << line << ") | " << msg << " ]";
34 __mFullMsg = runtime_error{stringStream.str()};
37 const char *CAudioError::what() const noexcept {
38 return __mFullMsg.what();
41 const char* CAudioError::getErrorMsg() const noexcept {
45 CAudioError::EError CAudioError::getError() const noexcept {
49 const char* CAudioError::__convertErrorToString(EError err) noexcept {
52 case EError::ERROR_NONE: return COLOR_GREEN "ERROR_NONE" COLOR_END;
53 case EError::ERROR_INVALID_ARGUMENT: return COLOR_RED "ERROR_INVALID_ARGUMENT" COLOR_END;
55 case EError::ERROR_INVALID_HANDLE: return COLOR_RED "ERROR_INVALID_HANDLE" COLOR_END;
56 case EError::ERROR_INVALID_POINTER: return COLOR_RED "ERROR_INVALID_POINTER" COLOR_END;
58 case EError::ERROR_INVALID_OPERATION: return COLOR_RED "ERROR_INVALID_OPERATION" COLOR_END;
59 case EError::ERROR_INVALID_STATE: return COLOR_RED "ERROR_INVALID_STATE" COLOR_END;
60 case EError::ERROR_NOT_INITIALIZED: return COLOR_RED "ERROR_NOT_INITIALIZED" COLOR_END;
61 case EError::ERROR_NOT_SUPPORTED: return COLOR_RED "ERROR_NOT_SUPPORTED" COLOR_END;
62 case EError::ERROR_NOT_SUPPORTED_TYPE: return COLOR_RED "ERROR_NOT_SUPPORTED_TYPE" COLOR_END;
64 case EError::ERROR_PERMISSION_DENIED: return COLOR_RED "ERROR_PERMISSION_DENIED" COLOR_END;
65 case EError::ERROR_DEVICE_POLICY_RESTRICTION: return COLOR_RED "ERROR_DEVICE_POLICY_RESTRICTION" COLOR_END;
66 case EError::ERROR_DEVICE_NOT_OPENED: return COLOR_RED "ERROR_DEVICE_NOT_OPENED" COLOR_END;
67 case EError::ERROR_DEVICE_NOT_CLOSED: return COLOR_RED "ERROR_DEVICE_NOT_CLOSED" COLOR_END;
68 case EError::ERROR_OUT_OF_MEMORY: return COLOR_RED "ERROR_OUT_OF_MEMORY" COLOR_END;
69 case EError::ERROR_INTERNAL_OPERATION: return COLOR_RED "ERROR_INTERNAL_OPERATION" COLOR_END;
70 case EError::ERROR_FAILED_OPERATION: return COLOR_RED "ERROR_FAILED_OPERATION" COLOR_END;
71 case EError::ERROR_POLICY_BLOCKED: return COLOR_RED "ERROR_POLICY_BLOCKED" COLOR_END;
72 case EError::ERROR_POLICY_INTERRUPTED: return COLOR_RED "ERROR_POLICY_INTERRUPTED" COLOR_END;
73 case EError::ERROR_POLICY_DUPLICATED: return COLOR_RED "ERROR_POLICY_DUPLICATED" COLOR_END;