fix: replace panics with error returns (#3420)

* refactor: replace panics with error returns

* fix: lints

* chore: add changes md
This commit is contained in:
Urs de Swardt
2026-05-18 15:56:33 +02:00
committed by GitHub
parent e919bab3eb
commit c0d64bf7d9
2 changed files with 24 additions and 6 deletions
+18 -6
View File
@@ -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",
)));
}
}
};