#include <unistd.h>
#include <vconf.h>
+#include <stdexcept>
+
#include "multi_assistant_main.h"
#include "dependency_resolver.h"
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_INITIALIZE);
} else {
- ret = func(interface, &dependency_version);
+ try {
+ ret = func(interface, &dependency_version);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_INITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to initialize, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_DEINITIALIZE);
} else {
- ret = func();
+ try {
+ ret = func();
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to deinitialize, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_SET_ERROR_CALLBACK);
} else {
- ret = func(callback, user_data);
+ try {
+ ret = func(callback, user_data);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to set error callback(%p, %p), ret(%d)", callback, user_data, ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_START_RECORDING);
} else {
- ret = func();
+ try {
+ ret = func();
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to start recording, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_STOP_RECORDING);
} else {
- ret = func();
+ try {
+ ret = func();
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_SET_RECORDING_SESSION);
} else {
- ret = func(session);
+ try {
+ ret = func(session);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to set recording session, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_SET_BACKGROUND_VOLUME);
} else {
- ret = func(ratio);
+ try {
+ ret = func(ratio);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to set background volume to %f, ret(%d)", ratio, ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT);
} else {
- ret = func(rate, channel, audio_type);
+ try {
+ ret = func(rate, channel, audio_type);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to get audio format, ret(%d)", ret);
}
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_GET_AUDIO_SOURCE_TYPE);
} else {
- ret = func(type);
+ try {
+ ret = func(type);
+ } catch (const std::exception& e) {
+ MAS_LOGE("[ERROR] %s of dependency module threw exception : %s",
+ MAS_DEPENDENCY_FUNC_DEINITIALIZE, e.what());
+ }
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to get audio source type, ret(%d)", ret);
}