summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/request_from_hmi.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/request_from_hmi.cc')
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index 570bc6017d..873d9a844f 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -173,16 +173,27 @@ void RequestFromHMI::SendProviderRequest(
LOG4CXX_AUTO_TRACE(logger_);
bool hmi_destination = false;
ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ hmi_apis::Common_Result::eType error_code =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+
if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
std::string service_type =
(*msg)[strings::msg_params][strings::service_type].asString();
application_manager_.GetAppServiceManager().GetProviderByType(
service_type, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
} else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
std::string service_id =
(*msg)[strings::msg_params][strings::service_id].asString();
application_manager_.GetAppServiceManager().GetProviderByID(
service_id, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = hmi_apis::Common_Result::INVALID_ID;
}
if (hmi_destination) {
@@ -196,6 +207,11 @@ void RequestFromHMI::SendProviderRequest(
if (!app) {
LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SendErrorResponse(correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()),
+ error_code,
+ error_msg,
+ commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
return;
}