From 19784757663a6fb2822acb32019a3347713f3ec9 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Wed, 18 Mar 2026 01:22:27 +0100 Subject: [PATCH] fix(error): migrate misc.rs to AppError --- src-tauri/src/commands/misc.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/commands/misc.rs b/src-tauri/src/commands/misc.rs index 4a41d65..6885493 100644 --- a/src-tauri/src/commands/misc.rs +++ b/src-tauri/src/commands/misc.rs @@ -1,5 +1,7 @@ // Miscellaneous commands — CLI args, URL opening, frontend telemetry +use crate::error::AppError; + #[tauri::command] pub fn cli_get_group() -> Option { let args: Vec = std::env::args().collect(); @@ -18,14 +20,14 @@ pub fn cli_get_group() -> Option { } #[tauri::command] -pub fn open_url(url: String) -> Result<(), String> { +pub fn open_url(url: String) -> Result<(), AppError> { if !url.starts_with("http://") && !url.starts_with("https://") { - return Err("Only http/https URLs are allowed".into()); + return Err(AppError::validation("Only http/https URLs are allowed")); } std::process::Command::new("xdg-open") .arg(&url) .spawn() - .map_err(|e| format!("Failed to open URL: {e}"))?; + .map_err(|e| AppError::internal(format!("Failed to open URL: {e}")))?; Ok(()) }