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(()) }