Skip to content

Commit

Permalink
fix(core): error is not send
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Sep 28, 2023
1 parent f18ccc1 commit 05060cf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ pub enum ErrKind {
Msg(String),
File(FileError),
Inner(Error),

#[cfg(feature = "web")]
JsError(wasm_bindgen::JsValue),
}

pub trait ErrKindExt {
Expand Down Expand Up @@ -69,7 +66,7 @@ impl ErrKindExt for &dyn std::fmt::Display {

impl ErrKindExt for wasm_bindgen::JsValue {
fn to_error_kind(self) -> ErrKind {
ErrKind::JsError(self)
ErrKind::Msg(format!("{:?}", self))
}
}

Expand Down Expand Up @@ -120,8 +117,6 @@ impl fmt::Display for Error {
ErrKind::File(e) => write!(f, "{}: {} with {:?}", err.loc, e, err.arguments),
ErrKind::Msg(msg) => write!(f, "{}: {} with {:?}", err.loc, msg, err.arguments),
ErrKind::Inner(e) => write!(f, "{}: {} with {:?}", err.loc, e, err.arguments),
#[cfg(feature = "web")]
ErrKind::JsError(e) => write!(f, "{}: {:?} with {:?}", err.loc, e, err.arguments),
ErrKind::None => write!(f, "{}: with {:?}", err.loc, err.arguments),
}
}
Expand Down Expand Up @@ -263,3 +258,9 @@ pub mod prelude {
pub use error_once_map;
pub use error_once_map_string;
}

#[test]
fn test_send() {
fn is_send<T: Send>() {}
is_send::<Error>();
}

0 comments on commit 05060cf

Please sign in to comment.