pkgmgrinfo_appinfo_h handle;
int ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out,
+ ("Failed to get app info: %d (%s)", ret, get_error_message(ret)));
return;
}
LoggerD("checking if application is still alive");
int ret = app_manager_get_app_id(that->pid_, &app_id);
if (APP_MANAGER_ERROR_NONE == ret) {
- LoggerD("application is alive - failure");
free(app_id);
// context is still alive, report error
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to kill application."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to kill application."),
+ &response->get<picojson::object>(),
+ ("application is alive - failure"));
} else {
LoggerD("application is dead - success: %d (%s)", ret, get_error_message(ret));
ReportSuccess(response->get<picojson::object>());
#define CHECK_RESULT(result, response, handler) \
if (result.IsError()) { \
- ReportError(result, &response->get<picojson::object>()); \
+ LogAndReportError(result, &response->get<picojson::object>()); \
handler->Invoke(response); \
delete handler; \
return; \
std::shared_ptr<picojson::value>* response) {
LoggerD("Enter");
- ReportError(result, &(*response)->get<picojson::object>());
+ LogAndReportError(result, &(*response)->get<picojson::object>());
TaskQueue::GetInstance().Async<picojson::value>([this](
const std::shared_ptr<picojson::value>& response) {
const auto& context = args.get("contextId");
if (!context.is<std::string>()) {
- LoggerE("Invalid parameter passed.");
- result = PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
+ result = LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
}
const std::string& context_id = context.get<std::string>();
if (context_id.empty() && result.IsSuccess()) {
- LoggerE("Context ID is empty.");
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Context ID is empty.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Context ID is empty.");
}
std::shared_ptr<picojson::value> response(new picojson::value(picojson::object()));
try {
pid = std::stoi(context_id);
} catch (...) {
- LoggerE("Failed to convert string to int");
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to convert string to int.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Failed to convert string to int.");
CHECK_RESULT(result, response, handler)
}
if (pid <= 0) {
- LoggerE("Context ID cannot be negative value");
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Context ID cannot be negative value.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Context ID cannot be negative value.");
CHECK_RESULT(result, response, handler)
}
// if kill request comes for current context, throw InvalidValuesException
if (CurrentApplication::GetInstance().GetProcessId() == pid) {
- LoggerE("Cannot kill current application.");
- result = PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Cannot kill current application.");
+ result = LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Cannot kill current application.");
CHECK_RESULT(result, response, handler)
}
std::unique_ptr<char, void(*)(void*)> app_id_ptr(app_id, &std::free);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get application ID, error: %d (%s)", ret, get_error_message(ret));
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.",
+ ("Failed to get application ID, error: %d (%s)", ret, get_error_message(ret)));
CHECK_RESULT(result, response, handler)
}
app_context_ptr(app_context, &app_context_destroy); // automatically release the memory
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get application context handle: %d (%s)", ret, get_error_message(ret));
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.",
+ ("Failed to get application context handle: %d (%s)", ret, get_error_message(ret)));
CHECK_RESULT(result, response, handler)
}
ret = app_manager_set_app_context_event_cb(terminate_callback, handler);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Error while registering app context event: %d (%s)", ret, get_error_message(ret));
- result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to register termination callback.");
+ result = LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to register termination callback.",
+ ("Error while registering app context event: %d (%s)", ret, get_error_message(ret)));
CHECK_RESULT(result, response, handler)
}
ret = app_manager_terminate_app(app_context);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to terminate application: %d (%s)", ret, get_error_message(ret));
- result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to terminate application.");
+ result = LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to terminate application.",
+ ("Failed to terminate application: %d (%s)", ret, get_error_message(ret)));
CHECK_RESULT(result, response, handler)
}
const auto& app_id = args.get("id");
if (!app_id.is<std::string>()) {
- LoggerE("Invalid parameter passed.");
- PlatformResult ret = PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
+ PlatformResult ret = LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
AsyncResponse(ret, &response);
return;
}
}
if (ret < 0) {
- result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error has occurred.");
+ result = LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Unknown error has occurred.");
LoggerD("Aul open return: %d (%s)", ret, get_error_message(ret));
switch (ret) {
case AUL_R_EINVAL:
case AUL_R_ERROR:
case AUL_R_ENOAPP:
- LoggerE("aul_open_app returns Not Found error");
- result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Launchpad returns not found error.");
+ result = LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Launchpad returns not found error.",
+ ("aul_open_app returns Not Found error"));
break;
case AUL_R_ECOMM:
- LoggerE("aul_open_app returns internal IPC error");
- result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Internal IPC error has occurred.");
+ result = LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Internal IPC error has occurred.",
+ ("aul_open_app returns internal IPC error"));
break;
}
- ReportError(result, &response->get<picojson::object>());
+ LogAndReportError(result, &response->get<picojson::object>());
} else {
LoggerD("Launch request success");
ReportSuccess(response->get<picojson::object>());
PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
const auto& control = args.get("appControl");
if (!control.is<picojson::object>()) {
- LoggerE("Invalid parameter passed.");
- result = PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
+ result = LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
AsyncResponse(result, &response);
return;
}
int ret = app_control_set_app_id(app_control_ptr.get(), app_id.c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed to set app id: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
+ &response->get<picojson::object>(),
+ ("Failed to set app id: %d (%s)", ret, get_error_message(ret)));
return;
}
}
} else if ("GROUP" == launch_mode_str) {
launch_mode = APP_CONTROL_LAUNCH_MODE_GROUP;
} else {
- LoggerE("Invalid parameter passed.");
ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
&response->get<picojson::object>());
return;
int ret = app_control_set_launch_mode(app_control_ptr.get(), launch_mode);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Setting launch mode failed: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Setting launch mode failed."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Setting launch mode failed."),
+ &response->get<picojson::object>(),
+ ("Setting launch mode failed: %d (%s)", ret, get_error_message(ret)));
return;
}
}
switch (ret) {
case APP_CONTROL_ERROR_INVALID_PARAMETER:
- LoggerE("app_control_send_launch_request returns APP_CONTROL_ERROR_INVALID_PARAMETER");
- ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter returned."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter returned."),
+ &response->get<picojson::object>(),
+ ("app_control_send_launch_request returns APP_CONTROL_ERROR_INVALID_PARAMETER"));
return;
case APP_CONTROL_ERROR_OUT_OF_MEMORY:
- LoggerE("app_control_send_launch_request returns APP_CONTROL_ERROR_OUT_OF_MEMORY");
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Out of memory."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Out of memory."),
+ &response->get<picojson::object>(),
+ ("app_control_send_launch_request returns APP_CONTROL_ERROR_OUT_OF_MEMORY"));
return;
case APP_CONTROL_ERROR_LAUNCH_REJECTED:
case APP_CONTROL_ERROR_APP_NOT_FOUND:
- LoggerE("app_control_send_launch_request returns APP_CONTROL_ERROR_APP_NOT_FOUND");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "No matched application found."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "No matched application found."),
+ &response->get<picojson::object>(),
+ ("app_control_send_launch_request returns APP_CONTROL_ERROR_APP_NOT_FOUND"));
return;
default:
- LoggerE("app_control_send_launch_request returns: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."),
- &response->get<picojson::object>());
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."),
+ &response->get<picojson::object>(),
+ ("app_control_send_launch_request returns: %d (%s)", ret, get_error_message(ret)));
return;
}
}
PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
const auto& control = args.get("appControl");
if (!control.is<picojson::object>()) {
- LoggerE("Invalid parameter passed.");
- result = PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
+ result = LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed.");
AsyncResponse(result, &response);
return;
}
app_control_ptr.get(), app_control_matched, &array.first->second.get<picojson::array>());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret));
-
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,"Unknown error"), &response_obj);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,"Unknown error"), &response_obj,
+ ("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret)));
// remove copied ApplicationControl from result
response_obj.erase(it_result);
} else {
int ret = app_manager_foreach_app_context(app_context_cb, &array);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("app_manager_foreach_app_context error: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj,
+ ("app_manager_foreach_app_context error: %d (%s)", ret, get_error_message(ret)));
} else {
ReportSuccess(result, response_obj);
}
try {
pid = std::stoi(context_id.get<std::string>());
} catch(...) {
- LoggerE("Failed to convert context id.");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to convert context id."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to convert context id."), out);
return;
}
} else {
if (APP_MANAGER_ERROR_NONE != ret || nullptr == app_id) {
switch(ret) {
case APP_MANAGER_ERROR_NO_SUCH_APP:
- LoggerE("app_manager_get_app_id returned: APP_MANAGER_ERROR_NO_SUCH_APP");
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "No such application exist."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "No such application exist."), out,
+ ("app_manager_get_app_id returned: APP_MANAGER_ERROR_NO_SUCH_APP"));
return;
case APP_MANAGER_ERROR_INVALID_PARAMETER:
- LoggerE("app_manager_get_app_id returned: APP_MANAGER_ERROR_INVALID_PARAMETER");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Application not found."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Application not found."), out,
+ ("app_manager_get_app_id returned: APP_MANAGER_ERROR_INVALID_PARAMETER"));
return;
default:
- LoggerE("app_manager_get_app_id returned: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), out,
+ ("app_manager_get_app_id returned: %d (%s)", ret, get_error_message(ret)));
return;
}
}
int ret = pkgmgrinfo_appinfo_get_usr_installed_list(app_info_cb, getuid(), &array);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("pkgmgrinfo_appinfo_get_usr_installed_list error");
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj,
+ ("pkgmgrinfo_appinfo_get_usr_installed_list error"));
} else {
ReportSuccess(result, response_obj);
}
pkgmgrinfo_appinfo_h handle = nullptr;
if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_usr_appinfo(app_id.c_str(), getuid(), &handle)) {
- LoggerE("Failed to get app info");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
return;
}
std::unique_ptr<char, void(*)(void*)> package_id_ptr(package_id, &std::free);
if (!package_id) {
- LoggerE("Failed to get package.");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get package."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get package."), out);
return;
}
pkg_info_ptr(pkg_info, &package_info_destroy); // automatically release the memory
if (PACKAGE_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out,
+ ("Failed to get package info: %d (%s)", ret, get_error_message(ret)));
return;
}
ret = package_info_foreach_cert_info(pkg_info, cert_info_cb, &result.get<picojson::array>());
if ((PACKAGE_MANAGER_ERROR_NONE != ret) && (PACKAGE_MANAGER_ERROR_IO_ERROR != ret)) {
- LoggerE("Failed to get certificates info: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get certificates info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get certificates info."), out,
+ ("Failed to get certificates info: %d (%s)", ret, get_error_message(ret)));
return;
}
std::unique_ptr<char, void(*)(void*)> package_id_ptr(package_id, &std::free);
if (!package_id) {
- LoggerE("Failed to get package.");
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get package."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get package."), out);
return;
}
pkg_info_ptr(pkg_info, &pkgmgrinfo_pkginfo_destroy_pkginfo); // automatically release the memory
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out,
+ ("Failed to get package info: %d (%s)", ret, get_error_message(ret)));
return;
}
ret = pkgmgrinfo_pkginfo_get_root_path(pkg_info, &root_path);
if (PMINFO_R_OK != ret || nullptr == root_path) {
- LoggerE("Failed to get root path: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get root path."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get root path."), out,
+ ("Failed to get root path: %d (%s)", ret, get_error_message(ret)));
return;
}
pkg_info_ptr(handle, &pkgmgrinfo_appinfo_destroy_appinfo); // automatically release the memory
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out,
+ ("Failed to get app info: %d (%s)", ret, get_error_message(ret)));
return;
}
ret = pkgmgrinfo_appinfo_foreach_metadata(handle, meta_data_cb, &result.get<picojson::array>());
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get metadata: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get metadata."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get metadata."), out,
+ ("Failed to get metadata: %d (%s)", ret, get_error_message(ret)));
return;
}
pkgmgrinfo_client_free(pkgmgrinfo_client_handle_);
pkgmgrinfo_client_handle_ = nullptr;
}
- ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to register listener."), out);
+ LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to register listener."), out);
return;
}
const auto& package_id = args.get("packageId");
if (!package_id.is<std::string>()) {
- LoggerE("Invalid parameter passed.");
- ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."), out);
+ LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."), out);
return;
}
ret = event_add_event_handler(event_name.c_str(), OnEvent, this, &event_handler);
LoggerD("event_add_event_handler() result: %d (%s)", ret, get_error_message(ret));
if (EVENT_ERROR_PERMISSION_DENIED == ret) {
- LOGGER(ERROR) << "event_add_event_handler failed, error: " << ret;
- return PlatformResult(ErrorCode::SECURITY_ERR, "The privilege is required");
+ return LogAndCreateResult(ErrorCode::SECURITY_ERR, "The privilege is required",
+ ("event_add_event_handler failed, error: %d", ret));
} else if (EVENT_ERROR_NONE != ret) {
- LOGGER(ERROR) << "event_add_event_handler failed, error: " << ret;
- return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error setting event listener");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Error setting event listener",
+ ("event_add_event_handler failed, error: %d", ret));
}
event_handler_map_[event_name] = event_handler;
bundle_free(bundle);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed to create app_control: %d (%s)", ret, get_error_message(ret));
- return PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to create app_control.");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Failed to create app_control.",
+ ("Failed to create app_control: %d (%s)", ret, get_error_message(ret)));
}
set_app_control(app_control);
const auto& data_arr = args.get("data");
if (!data_arr.is<picojson::array>()) {
- LoggerE("Invalid parameter passed.");
- ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."), out);
+ LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."), out);
return;
}
PlatformResult result = set_bundle(encoded_bundle);
if (result.IsError()) {
- LoggerE("Failed set_bundle()");
- ReportError(result, out);
+ LogAndReportError(result, out,
+ ("Failed set_bundle()"));
return;
}
// code to check caller liveness
result = VerifyCallerPresence();
if (result.IsError()) {
- LoggerE("Failed VerifyCallerPresence()");
- ReportError(result, out);
+ LogAndReportError(result, out,
+ ("Failed VerifyCallerPresence()"));
return;
}
result = ApplicationUtils::ApplicationControlDataToServiceExtraData(
iter->get<picojson::object>(), reply);
if (result.IsError()) {
- LoggerE("Failed ApplicationControlDataToServiceExtraData()");
- ReportError(result, out);
+ LogAndReportError(result, out,
+ ("Failed ApplicationControlDataToServiceExtraData()"));
return;
}
}
int ret = app_control_reply_to_launch_request(
reply, app_control_.get(), APP_CONTROL_RESULT_SUCCEEDED);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Cannot find caller: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller."), out,
+ ("Cannot find caller: %d (%s)", ret, get_error_message(ret)));
return;
}
PlatformResult result = set_bundle(encoded_bundle);
if (result.IsError()) {
- LoggerE("Failed set_bundle()");
- ReportError(result, out);
+ LogAndReportError(result, out, ("Failed set_bundle()"));
return;
}
// code to check caller liveness
result = VerifyCallerPresence();
if (result.IsError()) {
- LoggerE("Failed VerifyCallerPresence()");
- ReportError(result, out);
+ LogAndReportError(result, out, ("Failed VerifyCallerPresence()"));
return;
}
// send reply
int ret = app_control_reply_to_launch_request(reply, app_control_.get(), APP_CONTROL_RESULT_FAILED);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Cannot find caller: %d (%s)", ret, get_error_message(ret));
- ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller."), out);
+ LogAndReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller."), out,
+ ("Cannot find caller: %d (%s)", ret, get_error_message(ret)));
return;
}
LoggerD("Entered");
if (caller_app_id_.empty()) {
- LoggerE("caller_app_id_ is empty. This means caller is dead.");
- return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller.");
+ return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller.",
+ ("caller_app_id_ is empty. This means caller is dead."));
} else {
bool running = false;
int ret = app_manager_is_running(caller_app_id_.c_str(), &running);
if ((APP_MANAGER_ERROR_NONE != ret) || !running) {
- LoggerE("Caller is not running: %d (%s)", ret, get_error_message(ret));
- return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller.");
+ return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Cannot find caller.",
+ ("Caller is not running: %d (%s)", ret, get_error_message(ret)));
}
return PlatformResult(ErrorCode::NO_ERROR);