fix: make error enum public

This commit is contained in:
Jonas Kruckenberg 2023-12-14 11:23:59 +01:00
parent 5d259531c3
commit fe330206aa
No known key found for this signature in database
GPG key ID: 55B37D49677B1FAC
2 changed files with 6 additions and 6 deletions

View file

@ -3,15 +3,15 @@ use wasm_bindgen::JsValue;
#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)]
pub enum Error {
#[error("JS Binding: {0}")]
Binding(String),
#[error("JSON: {0}")]
#[error("Command returned Error: {0}")]
Command(String),
#[error("Failed to parse JSON: {0}")]
Serde(String),
#[cfg(any(feature = "event", feature = "window"))]
#[error("Oneshot cancelled: {0}")]
OneshotCanceled(#[from] futures::channel::oneshot::Canceled),
#[cfg(feature = "fs")]
#[error("could not convert path to string")]
#[error("Could not convert path to string")]
Utf8(PathBuf),
}
@ -23,6 +23,6 @@ impl From<serde_wasm_bindgen::Error> for Error {
impl From<JsValue> for Error {
fn from(e: JsValue) -> Self {
Self::Binding(format!("{:?}", e))
Self::Command(format!("{:?}", e))
}
}

View file

@ -148,7 +148,7 @@ pub mod updater;
#[cfg(feature = "window")]
pub mod window;
pub(crate) use error::Error;
pub use error::Error;
pub(crate) type Result<T> = core::result::Result<T, Error>;
#[cfg(any(feature = "dialog", feature = "window"))]