Skip to content

Commit

Permalink
feat(core): add error message on error::CreateWebview (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Apr 23, 2021
1 parent 1e0b41e commit 7471e34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/create-webview-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

`tauri::error::CreateWebview` now has the error string message attached.
4 changes: 2 additions & 2 deletions core/tauri/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions core/tauri/src/runtime/flavors/wry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -466,7 +466,7 @@ impl Runtime for Wry {
type Dispatcher = WryDispatcher;

fn new() -> crate::Result<Self> {
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 })
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7471e34

Please sign in to comment.