Skip to content

Commit

Permalink
fix: check list of topics to update to prevent an internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewinci committed Jan 30, 2023
1 parent 9906cc0 commit 8a7ce90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion backend/src/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use crate::core::{
consumer::types::ConsumerOffsetConfiguration,
};

use super::{error::ApiResult, AppState};
use super::{
error::{ApiError, ApiResult},
AppState,
};

#[tauri::command]
pub async fn list_topics(cluster_id: &str, state: tauri::State<'_, AppState>) -> ApiResult<Vec<Topic>> {
Expand Down Expand Up @@ -98,6 +101,12 @@ pub async fn set_consumer_group(
"Set consumer group {} to offset {:?}",
consumer_group_name, offset_config
);
if topics.is_empty() {
return Err(ApiError {
error_type: "Update consumer group error".into(),
message: "Empty list of topics to update. Specify at least one topic to update".into(),
});
}
let cluster = state.get_cluster(cluster_id).await?;
Ok(cluster
.kafka_admin_client
Expand Down

0 comments on commit 8a7ce90

Please sign in to comment.