Skip to content

Commit

Permalink
fix: update version mismatch error text (#4204)
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata authored Oct 8, 2024
1 parent fde8d01 commit 2d0d5d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/fluvio/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ use fluvio_sc_schema::{AdminSpec, DeletableAdminSpec, CreatableAdminSpec, TryEnc
use fluvio_socket::{ClientConfig, VersionedSerialSocket, SerialFrame, MultiplexerSocket};

use crate::FluvioConfig;
use crate::metadata::objects::{ListResponse, ListRequest};
use crate::config::ConfigFile;
use crate::error::anyhow_version_error;
use crate::metadata::objects::{ListResponse, ListRequest};
use crate::sync::MetadataStores;

/// An interface for managing a Fluvio cluster
Expand Down Expand Up @@ -135,9 +136,8 @@ impl FluvioAdmin {
metadata,
})
} else {
let platform_version = versions.platform_version();
let client_version = crate::VERSION.trim();
Err(anyhow!("Fluvio Client {client_version} and Cluster {platform_version} versions are not compatible. Please upgrade client to {platform_version}"))
let platform_version = versions.platform_version().to_string();
Err(anyhow_version_error(&platform_version))
}
}

Expand Down
6 changes: 6 additions & 0 deletions crates/fluvio/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ To interact with this cluster, please install the matching CLI version using the
#[error("Unknown error: {0}")]
Other(String),
}

pub fn anyhow_version_error(platform_ver: &str) -> anyhow::Error {
use anyhow::anyhow;
let client_ver = crate::VERSION.trim();
anyhow!("Fluvio Client {client_ver} and Cluster {platform_ver} versions are not compatible. Please use a client compatible with {platform_ver}")
}
8 changes: 4 additions & 4 deletions crates/fluvio/src/fluvio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use fluvio_sc_schema::topic::PartitionMap;
use fluvio_sc_schema::topic::ReplicaSpec;
use tracing::{debug, info};
use tokio::sync::OnceCell;
use anyhow::{anyhow, Result};
use anyhow::Result;

use fluvio_sc_schema::objects::ObjectApiWatchRequest;
use fluvio_types::PartitionId;
Expand All @@ -18,6 +18,7 @@ use fluvio_future::net::DomainConnector;
use semver::Version;

use crate::admin::FluvioAdmin;
use crate::error::anyhow_version_error;
use crate::producer::TopicProducerPool;
use crate::spu::SpuPool;
use crate::TopicProducer;
Expand Down Expand Up @@ -122,9 +123,8 @@ impl Fluvio {
metric: Arc::new(ClientMetrics::new()),
})
} else {
let platform_version = versions.platform_version();
let client_version = crate::VERSION.trim();
Err(anyhow!("Fluvio Client {client_version} and Cluster {platform_version} versions are not compatible. Please upgrade client to {platform_version}"))
let platform_version = versions.platform_version().to_string();
Err(anyhow_version_error(&platform_version))
}
}

Expand Down

0 comments on commit 2d0d5d8

Please sign in to comment.