mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-08 22:31:11 +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:
1 parent
e919bab3eb
commit
c0d64bf7d9
2 files changed
+24
-6
No files matched your search
@@ -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 }
|
||||
} 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<R: Runtime>(
|
||||
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<R: Runtime>(
|
||||
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<R: Runtime>(
|
||||
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<R: Runtime>(
|
||||
|
||||
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<R: Runtime>(
|
||||
y: tray_y,
|
||||
}
|
||||
} 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