diff --git a/.changes/positioner-panic.md b/.changes/positioner-panic.md new file mode 100644 index 000000000..deeb7aac0 --- /dev/null +++ b/.changes/positioner-panic.md @@ -0,0 +1,6 @@ +--- +positioner: patch +positioner-js: patch +--- + +Removed panics and replaced them with error handling. \ No newline at end of file diff --git a/plugins/positioner/src/ext.rs b/plugins/positioner/src/ext.rs index b3d405ea2..7c9be8c29 100644 --- a/plugins/positioner/src/ext.rs +++ b/plugins/positioner/src/ext.rs @@ -225,7 +225,9 @@ fn calculate_position( PhysicalPosition { x: tray_x, y } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } #[cfg(feature = "tray-icon")] @@ -236,7 +238,9 @@ fn calculate_position( y: tray_y, } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } #[cfg(feature = "tray-icon")] @@ -257,7 +261,9 @@ fn calculate_position( y, } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } #[cfg(feature = "tray-icon")] @@ -268,7 +274,9 @@ fn calculate_position( y: tray_y, } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } #[cfg(feature = "tray-icon")] @@ -287,7 +295,9 @@ fn calculate_position( PhysicalPosition { x, y } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } #[cfg(feature = "tray-icon")] @@ -298,7 +308,9 @@ fn calculate_position( y: tray_y, } } else { - panic!("Tray position not set"); + return Err(tauri::Error::Io(std::io::Error::other( + "Tray position not set", + ))); } } };