diff --git a/rust/agama-lib/src/error.rs b/rust/agama-lib/src/error.rs index 6eb77748c8..e9a9f205ca 100644 --- a/rust/agama-lib/src/error.rs +++ b/rust/agama-lib/src/error.rs @@ -6,8 +6,10 @@ use zbus; #[derive(Error, Debug)] pub enum ServiceError { - #[error("D-Bus service error: {0}")] + #[error("D-Bus service error")] DBus(#[from] zbus::Error), + #[error("Could not connect to Agama bus at '{0}'")] + DBusConnectionError(String, #[source] zbus::Error), #[error("Unknown product '{0}'. Available products: '{1:?}'")] UnknownProduct(String, Vec), // it's fine to say only "Error" because the original @@ -24,7 +26,7 @@ pub enum ProfileError { Unreachable(#[from] curl::Error), #[error("Jsonnet evaluation failed:\n{0}")] EvaluationError(String), - #[error("I/O error: '{0}'")] + #[error("I/O error")] InputOutputError(#[from] io::Error), #[error("The profile is not a valid JSON file")] FormatError(#[from] serde_json::Error), diff --git a/rust/agama-lib/src/lib.rs b/rust/agama-lib/src/lib.rs index 916fc0778b..b6cd66a3ef 100644 --- a/rust/agama-lib/src/lib.rs +++ b/rust/agama-lib/src/lib.rs @@ -40,7 +40,6 @@ mod store; pub use store::Store; use crate::error::ServiceError; -use anyhow::Context; const ADDRESS: &str = "unix:path=/run/agama/bus"; @@ -52,6 +51,6 @@ pub async fn connection_to(address: &str) -> Result