std::string delay_str = std::to_string(delay);
int ret = app_control_add_extra_data(app_control, kAlarmRelativeDelayKey, delay_str.c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Fail to add data from app_control.");
+ LoggerE("Fail to add data from app_control: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(
ErrorCode::UNKNOWN_ERR, "Fail to add data from app_control."), &out);
return;
ret = alarm_schedule_after_delay(app_control, delay, period, &alarm_id);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Error while add alarm to server.");
+ LoggerE("Error while add alarm to server: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while add alarm to server."), &out);
return;
}
}
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Adding alarm to server failed.");
+ LoggerE("Adding alarm to server failed: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Adding alarm to server failed."), &out);
return;
}
LoggerE("Alarm not found.");
ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Alarm not found."), &out);
} else {
- LoggerE("Platform unknown error.");
+ LoggerE("Platform unknown error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Platform unknown error."), &out);
}
}
void AlarmManager::RemoveAll(const picojson::value& args, picojson::object& out) {
LoggerD("Entered");
- if (ALARM_ERROR_NONE != alarm_cancel_all()) {
- LoggerE("Platform unknown error.");
+ int ret = alarm_cancel_all();
+ if (ALARM_ERROR_NONE != ret) {
+ LoggerE("Platform unknown error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Platform unknown error."), &out);
return;
}
ret = alarm_get_app_control(id, &app_control);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Alarm not found");
+ LoggerE("Alarm not found: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Alarm not found.");
}
ret = app_control_get_extra_data(app_control, kAlarmKeyType, &alarm_type);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Getting data failed");
+ LoggerE("Getting data failed: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error occurred.");
}
ret = app_control_get_extra_data(app_control, kAlarmAbsoluteDateKey, &date_string);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed to get data.");
+ LoggerE("Failed to get data: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get data.");
}
if (!strcmp(alarm_type, kAlarmAbsoluteReccurrenceTypeInterval)) {
ret = alarm_get_scheduled_period(id, &interval);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Unknown error occurred.");
+ LoggerE("Unknown error occurred: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error occurred.");
}
ret = alarm_get_scheduled_recurrence_week_flag(id, &byDayValue);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Failed to get data.");
+ LoggerE("Failed to get data: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get data.");
}
ret = alarm_get_scheduled_period(id, &interval);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Unknown error occurred.");
+ LoggerE("Unknown error occurred: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error occurred.");
}
ret = app_control_get_extra_data(app_control, kAlarmRelativeDelayKey, &delay_string);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed to get data.");
+ LoggerE("Failed to get data: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get data.");
}
int ret = alarm_foreach_registered_alarm(AlarmIterateCB, &alarm_ids);
if (ALARM_ERROR_NONE != ret) {
- LoggerE("Platform unknown error.");
+ LoggerE("Platform unknown error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Platform unknown error."), &out);
return;
}
int ret = alarm_get_scheduled_date(id, &date);
if(ALARM_ERROR_NONE != ret) {
- LoggerI("alarm_get_scheduled_date error %d", ret);
+ LoggerI("alarm_get_scheduled_date error: %d (%s)", ret, get_error_message(ret));
if (ALARM_ERROR_INVALID_PARAMETER == ret || ALARM_ERROR_CONNECTION_FAIL == ret) {
result_obj.insert(std::make_pair("seconds", picojson::value()));
ReportSuccess(result, out);
int ret = app_control_set_operation(*app_control, it_operation->second.get<std::string>().c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed app_control_set_operation() (%d)", ret);
+ LoggerE("Failed app_control_set_operation(): %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while setting operation.");
}
if (it_end != it_uri && it_uri->second.is<std::string>()) {
ret = app_control_set_uri(*app_control, it_uri->second.get<std::string>().c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed app_control_set_uri() (%d)", ret);
+ LoggerE("Failed app_control_set_uri(): %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while setting uri.");
}
}
if (it_end != it_mime && it_mime->second.is<std::string>()) {
ret = app_control_set_mime(*app_control, it_mime->second.get<std::string>().c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed app_control_set_mime() (%d)", ret);
+ LoggerE("Failed app_control_set_mime(): %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while setting mime.");
}
}
if (it_end != it_category && it_category->second.is<std::string>()) {
ret = app_control_set_category(*app_control, it_category->second.get<std::string>().c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed app_control_set_category() (%d)", ret);
+ LoggerE("Failed app_control_set_category(): %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while setting category.");
}
}
delete[] arr;
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerD("Error while setting data.");
+ LoggerD("Error while setting data: %d (%s)", ret, get_error_message(ret));
return PlatformResult(ErrorCode::UNKNOWN_ERR, "Error while setting data.");
}