aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src
diff options
context:
space:
mode:
authorBegonia, HE <163421589+BegoniaHe@users.noreply.github.com>2026-01-25 10:46:30 +0100
committerBegonia, HE <163421589+BegoniaHe@users.noreply.github.com>2026-01-29 02:59:06 +0100
commit2c90c392114a8948190e4253f0cae9379f3a614d (patch)
treea546ba8c5d75fe61364cfd52b7910da580ec410e /src-tauri/src
parentaba94d55f00c4241c12f5d7ccd6e87c5955a3fd5 (diff)
downloadDropOut-2c90c392114a8948190e4253f0cae9379f3a614d.tar.gz
DropOut-2c90c392114a8948190e4253f0cae9379f3a614d.zip
refactor(java): replace unwrap with expect for better error handling
Replace potentially panicking unwrap() call with expect() that includes a descriptive error message to aid debugging if the edge case occurs. Reviewed-by: Claude Sonnet 4.5
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/core/java/persistence.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src-tauri/src/core/java/persistence.rs b/src-tauri/src/core/java/persistence.rs
index 5e263fb..d1e999e 100644
--- a/src-tauri/src/core/java/persistence.rs
+++ b/src-tauri/src/core/java/persistence.rs
@@ -42,7 +42,12 @@ pub fn load_java_config(app_handle: &AppHandle) -> JavaConfig {
pub fn save_java_config(app_handle: &AppHandle, config: &JavaConfig) -> Result<(), String> {
let config_path = get_java_config_path(app_handle);
let content = serde_json::to_string_pretty(config).map_err(|e| e.to_string())?;
- std::fs::create_dir_all(config_path.parent().unwrap()).map_err(|e| e.to_string())?;
+ std::fs::create_dir_all(
+ config_path
+ .parent()
+ .expect("Java config path should have a parent directory"),
+ )
+ .map_err(|e| e.to_string())?;
std::fs::write(&config_path, content).map_err(|e| e.to_string())?;
Ok(())
}