diff --git a/mediarepo-api/Cargo.toml b/mediarepo-api/Cargo.toml index 9df85dc..9030736 100644 --- a/mediarepo-api/Cargo.toml +++ b/mediarepo-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mediarepo-api" -version = "0.4.1" +version = "0.4.2" edition = "2018" license = "gpl-3" diff --git a/mediarepo-api/src/client_api/error.rs b/mediarepo-api/src/client_api/error.rs index 0e88754..8634385 100644 --- a/mediarepo-api/src/client_api/error.rs +++ b/mediarepo-api/src/client_api/error.rs @@ -7,6 +7,6 @@ pub enum ApiError { #[error(transparent)] IPC(#[from] rmp_ipc::error::Error), - #[error("The servers api version is incompatible with the api client")] - VersionMismatch, + #[error("The servers api version (version {server:?}) is incompatible with the api client {client:?}")] + VersionMismatch { server: String, client: String }, } diff --git a/mediarepo-api/src/client_api/mod.rs b/mediarepo-api/src/client_api/mod.rs index fb60401..650c651 100644 --- a/mediarepo-api/src/client_api/mod.rs +++ b/mediarepo-api/src/client_api/mod.rs @@ -77,7 +77,15 @@ impl ApiClient { let server_api_version = info.api_version(); if !check_apis_compatible(get_api_version(), server_api_version) { - Err(ApiError::VersionMismatch) + let server_version_string = format!( + "{}.{}.{}", + server_api_version.0, server_api_version.1, server_api_version.2 + ); + let client_version_string = env!("CARGO_PKG_VERSION").to_string(); + Err(ApiError::VersionMismatch { + server: server_version_string, + client: client_version_string, + }) } else { Ok(client) } diff --git a/mediarepo-api/src/tauri_plugin/error.rs b/mediarepo-api/src/tauri_plugin/error.rs index 705dca3..5547863 100644 --- a/mediarepo-api/src/tauri_plugin/error.rs +++ b/mediarepo-api/src/tauri_plugin/error.rs @@ -46,7 +46,9 @@ impl From for PluginError { format!("{:?}", e) } }, - ApiError::VersionMismatch => {String::from("The servers API version is not supported by the client. Please make sure both are up to date.")} + ApiError::VersionMismatch { server, client } => { + format!("The servers API version ({}) is not supported by the client ({}). Please make sure both are up to date.", server, client) + } }; Self { message } }