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.
20 #include "CAudioIODef.h"
23 using namespace tizen_media_audio;
28 CAudioError::CAudioError(EError err, const char* msg, const char* file, const char* func, int line) :
31 char __mErrorMsg[MSG_LENGTH] = { 0, };
32 snprintf(__mErrorMsg, MSG_LENGTH, "[%s|%s|%s(%d)|"
33 COLOR_CYAN "%s" COLOR_END "]",
34 __convertErrorToString(__mError), file, func, line, msg);
36 __mFullMsg = __mErrorMsg;
39 const char* CAudioError::getErrorMsg() const noexcept {
43 const CAudioError::EError CAudioError::getError() const noexcept {
47 const char* CAudioError::__convertErrorToString(EError err) noexcept {
50 case EError::ERROR_NONE: return COLOR_GREEN "ERROR_NONE" COLOR_END;
51 case EError::ERROR_INVALID_ARGUMENT: return COLOR_RED "ERROR_INVALID_ARGUMENT" COLOR_END;
53 case EError::ERROR_INVALID_HANDLE: return COLOR_RED "ERROR_INVALID_HANDLE" COLOR_END;
54 case EError::ERROR_INVALID_POINTER: return COLOR_RED "ERROR_INVALID_POINTER" COLOR_END;
56 case EError::ERROR_INVALID_OPERATION: return COLOR_RED "ERROR_INVALID_OPERATION" COLOR_END;
57 case EError::ERROR_INVALID_STATE: return COLOR_RED "ERROR_INVALID_STATE" COLOR_END;
58 case EError::ERROR_NOT_INITIALIZED: return COLOR_RED "ERROR_NOT_INITIALIZED" COLOR_END;
59 case EError::ERROR_NOT_SUPPORTED: return COLOR_RED "ERROR_NOT_SUPPORTED" COLOR_END;
60 case EError::ERROR_NOT_SUPPORTED_TYPE: return COLOR_RED "ERROR_NOT_SUPPORTED_TYPE" COLOR_END;
62 case EError::ERROR_PERMISSION_DENIED: return COLOR_RED "ERROR_PERMISSION_DENIED" COLOR_END;
63 case EError::ERROR_DEVICE_POLICY_RESTRICTION: return COLOR_RED "ERROR_DEVICE_POLICY_RESTRICTION" COLOR_END;
64 case EError::ERROR_DEVICE_NOT_OPENED: return COLOR_RED "ERROR_DEVICE_NOT_OPENED" COLOR_END;
65 case EError::ERROR_DEVICE_NOT_CLOSED: return COLOR_RED "ERROR_DEVICE_NOT_CLOSED" COLOR_END;
66 case EError::ERROR_OUT_OF_MEMORY: return COLOR_RED "ERROR_OUT_OF_MEMORY" COLOR_END;
67 case EError::ERROR_INTERNAL_OPERATION: return COLOR_RED "ERROR_INTERNAL_OPERATION" COLOR_END;
68 case EError::ERROR_FAILED_OPERATION: return COLOR_RED "ERROR_FAILED_OPERATION" COLOR_END;
69 case EError::ERROR_POLICY_BLOCKED: return COLOR_RED "ERROR_POLICY_BLOCKED" COLOR_END;
70 case EError::ERROR_POLICY_INTERRUPTED: return COLOR_RED "ERROR_POLICY_INTERRUPTED" COLOR_END;
71 case EError::ERROR_POLICY_DUPLICATED: return COLOR_RED "ERROR_POLICY_DUPLICATED" COLOR_END;