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,