feat(core): add error message on error::CreateWebview (#1602)

This commit is contained in:
Lucas Fernandes Nogueira 2021-04-23 15:30:02 -03:00 committed by GitHub
parent 1e0b41e155
commit 7471e347d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
`tauri::error::CreateWebview` now has the error string message attached.

View File

@ -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,

View File

@ -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<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 })
}
@ -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,