notification_free(notification_handle);
};
- ret = alarm_get_app_control(id, &app_control);
- if (ALARM_ERROR_NONE != ret) {
- return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Unknown error occurred.",
- ("Getting data failed: %d (%s)", ret, get_error_message(ret)));
- } else {
- ret = alarm_get_notification(id, ¬ification_handle);
- if (ALARM_ERROR_NONE != ret) {
+ if (ALARM_ERROR_NONE != alarm_get_app_control(id, &app_control)) {
+ // This is a special kind of alarm, which has the notification instead of an app_control handle.
+ // In case of error during app_control gathering, we check if it has notification. If both calls
+ // end with error, then we report NOT_FOUND_ERROR
+ if (ALARM_ERROR_NONE != alarm_get_notification(id, ¬ification_handle)) {
return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Alarm not found.",
("Alarm not found: %d (%s)", ret, get_error_message(ret)));
} else {