From 7471e347d3b23b7604c19040b0d989da8f48cb91 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Fri, 23 Apr 2021 15:30:02 -0300 Subject: [PATCH] feat(core): add error message on `error::CreateWebview` (#1602) --- .changes/create-webview-error.md | 5 +++++ core/tauri/src/error.rs | 4 ++-- core/tauri/src/runtime/flavors/wry.rs | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changes/create-webview-error.md diff --git a/.changes/create-webview-error.md b/.changes/create-webview-error.md new file mode 100644 index 000000000..e47dcff58 --- /dev/null +++ b/.changes/create-webview-error.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +`tauri::error::CreateWebview` now has the error string message attached. diff --git a/core/tauri/src/error.rs b/core/tauri/src/error.rs index 5d630c9ce..beeeac157 100644 --- a/core/tauri/src/error.rs +++ b/core/tauri/src/error.rs @@ -8,8 +8,8 @@ use std::path::PathBuf; #[derive(Debug, thiserror::Error)] pub enum Error { /// Failed to create webview. - #[error("failed to create webview")] - CreateWebview, + #[error("failed to create webview: {0}")] + CreateWebview(String), /// Failed to create window. #[error("failed to create window")] CreateWindow, diff --git a/core/tauri/src/runtime/flavors/wry.rs b/core/tauri/src/runtime/flavors/wry.rs index abf1f8d87..fb8f28786 100644 --- a/core/tauri/src/runtime/flavors/wry.rs +++ b/core/tauri/src/runtime/flavors/wry.rs @@ -292,7 +292,7 @@ impl Dispatch for WryDispatcher { custom_protocols.into_iter().map(|(_, p)| p).collect(), file_drop_handler, ) - .map_err(|_| crate::Error::CreateWebview)?; + .map_err(|e| crate::Error::CreateWebview(e.to_string()))?; let dispatcher = WryDispatcher { window, @@ -466,7 +466,7 @@ impl Runtime for Wry { type Dispatcher = WryDispatcher; fn new() -> crate::Result { - let app = wry::Application::new().map_err(|_| crate::Error::CreateWebview)?; + let app = wry::Application::new().map_err(|e| crate::Error::CreateWebview(e.to_string()))?; Ok(Self { inner: app }) } @@ -506,7 +506,7 @@ impl Runtime for Wry { custom_protocols.into_iter().map(|(_, p)| p).collect(), file_drop_handler, ) - .map_err(|_| crate::Error::CreateWebview)?; + .map_err(|e| crate::Error::CreateWebview(e.to_string()))?; let dispatcher = WryDispatcher { window,