From 2f36386feacf91493d7ea78ed601e1c90b1c282d Mon Sep 17 00:00:00 2001 From: Aleksander <170264518+t-aleksander@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:59:33 +0100 Subject: [PATCH] modify error handling --- src-tauri/cli/src/bin/dg.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src-tauri/cli/src/bin/dg.rs b/src-tauri/cli/src/bin/dg.rs index 90b8d78d..fa78847b 100644 --- a/src-tauri/cli/src/bin/dg.rs +++ b/src-tauri/cli/src/bin/dg.rs @@ -91,16 +91,20 @@ impl CliConfig { }; #[cfg(not(windows))] { - let mut perms = file - .metadata() - .map_err(|err| { - CliError::ConfigSave(path.to_string_lossy().to_string(), err.to_string()) - })? - .permissions(); - perms.set_mode(0o600); - file.set_permissions(perms).map_err(|err| { - CliError::ConfigSave(path.to_string_lossy().to_string(), err.to_string()) - })?; + debug!("Setting config file permissions..."); + match file.metadata() { + Ok(meta) => { + let mut perms = meta.permissions(); + perms.set_mode(0o600); + if let Err(err) = file.set_permissions(perms) { + warn!("Failed to set permissions for the configuration file: {err}"); + } + } + Err(err) => { + warn!("Failed to set permissions for the configuration file: {err}") + } + } + debug!("Config file permissions have been set."); } match serde_json::to_writer(file, &self) { Ok(()) => debug!(