refactor!: change Webview::navigate to return result (#10134)

closes #9935
This commit is contained in:
Amr Bashir 2024-06-27 15:43:34 +03:00 committed by GitHub
parent 77d44215ef
commit 3afe828940
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": "patch:breaking"
---
Changed `WebviewWindow::navigate` and `Webview::navigate` method signature to return a `Result`

View File

@ -1084,8 +1084,8 @@ fn main() {
}
/// Navigates the webview to the defined url.
pub fn navigate(&mut self, url: Url) {
self.webview.dispatcher.navigate(url).unwrap();
pub fn navigate(&mut self, url: Url) -> crate::Result<()> {
self.webview.dispatcher.navigate(url).map_err(Into::into)
}
fn is_local_url(&self, current_url: &Url) -> bool {

View File

@ -1665,8 +1665,8 @@ impl<R: Runtime> WebviewWindow<R> {
}
/// Navigates the webview to the defined url.
pub fn navigate(&mut self, url: Url) {
self.webview.navigate(url);
pub fn navigate(&mut self, url: Url) -> crate::Result<()> {
self.webview.navigate(url)
}
/// Handles this window receiving an [`crate::webview::InvokeRequest`].