Skip to content

Commit 7471e34

Browse files
authored
feat(core): add error message on error::CreateWebview (#1602)
1 parent 1e0b41e commit 7471e34

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.changes/create-webview-error.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
`tauri::error::CreateWebview` now has the error string message attached.

core/tauri/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use std::path::PathBuf;
88
#[derive(Debug, thiserror::Error)]
99
pub enum Error {
1010
/// Failed to create webview.
11-
#[error("failed to create webview")]
12-
CreateWebview,
11+
#[error("failed to create webview: {0}")]
12+
CreateWebview(String),
1313
/// Failed to create window.
1414
#[error("failed to create window")]
1515
CreateWindow,

core/tauri/src/runtime/flavors/wry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl Dispatch for WryDispatcher {
292292
custom_protocols.into_iter().map(|(_, p)| p).collect(),
293293
file_drop_handler,
294294
)
295-
.map_err(|_| crate::Error::CreateWebview)?;
295+
.map_err(|e| crate::Error::CreateWebview(e.to_string()))?;
296296

297297
let dispatcher = WryDispatcher {
298298
window,
@@ -466,7 +466,7 @@ impl Runtime for Wry {
466466
type Dispatcher = WryDispatcher;
467467

468468
fn new() -> crate::Result<Self> {
469-
let app = wry::Application::new().map_err(|_| crate::Error::CreateWebview)?;
469+
let app = wry::Application::new().map_err(|e| crate::Error::CreateWebview(e.to_string()))?;
470470
Ok(Self { inner: app })
471471
}
472472

@@ -506,7 +506,7 @@ impl Runtime for Wry {
506506
custom_protocols.into_iter().map(|(_, p)| p).collect(),
507507
file_drop_handler,
508508
)
509-
.map_err(|_| crate::Error::CreateWebview)?;
509+
.map_err(|e| crate::Error::CreateWebview(e.to_string()))?;
510510

511511
let dispatcher = WryDispatcher {
512512
window,

0 commit comments

Comments
 (0)