mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-23 19:32:29 +02:00
fix: replace panics with error returns (#3420)
* refactor: replace panics with error returns * fix: lints * chore: add changes md
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
positioner: patch
|
||||||
|
positioner-js: patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Removed panics and replaced them with error handling.
|
||||||
@@ -225,7 +225,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
|
|
||||||
PhysicalPosition { x: tray_x, y }
|
PhysicalPosition { x: tray_x, y }
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "tray-icon")]
|
#[cfg(feature = "tray-icon")]
|
||||||
@@ -236,7 +238,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
y: tray_y,
|
y: tray_y,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "tray-icon")]
|
#[cfg(feature = "tray-icon")]
|
||||||
@@ -257,7 +261,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
y,
|
y,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "tray-icon")]
|
#[cfg(feature = "tray-icon")]
|
||||||
@@ -268,7 +274,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
y: tray_y,
|
y: tray_y,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "tray-icon")]
|
#[cfg(feature = "tray-icon")]
|
||||||
@@ -287,7 +295,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
|
|
||||||
PhysicalPosition { x, y }
|
PhysicalPosition { x, y }
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "tray-icon")]
|
#[cfg(feature = "tray-icon")]
|
||||||
@@ -298,7 +308,9 @@ fn calculate_position<R: Runtime>(
|
|||||||
y: tray_y,
|
y: tray_y,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("Tray position not set");
|
return Err(tauri::Error::Io(std::io::Error::other(
|
||||||
|
"Tray position not set",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user