diff options
Diffstat (limited to 'lampada/src/error.rs')
-rw-r--r-- | lampada/src/error.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lampada/src/error.rs b/lampada/src/error.rs index 8104155..a5af3a2 100644 --- a/lampada/src/error.rs +++ b/lampada/src/error.rs @@ -2,10 +2,13 @@ use std::sync::Arc; use stanza::client::Stanza; use thiserror::Error; -use tokio::{ - sync::{mpsc::error::SendError, oneshot::error::RecvError}, - time::error::Elapsed, -}; +use tokio::sync::{mpsc::error::SendError, oneshot::error::RecvError}; +#[cfg(not(target_arch = "wasm32"))] +use tokio::time::error::Elapsed; +#[cfg(target_arch = "wasm32")] +use tokio::time::Elapsed; +#[cfg(target_arch = "wasm32")] +use tokio_with_wasm::alias as tokio; #[derive(Debug, Error, Clone)] pub enum ConnectionError { @@ -21,10 +24,11 @@ pub enum ConnectionError { #[error("disconnected")] Disconnected, #[error("invalid server jid: {0}")] - InvalidServerJID(#[from] jid::ParseError), + InvalidServerJID(#[from] jid::JIDError), } #[derive(Debug, Error, Clone)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum CommandError<T> { #[error("actor: {0}")] Actor(ActorError), @@ -58,6 +62,7 @@ pub enum ReadError { } #[derive(Debug, Error, Clone)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub enum ActorError { #[error("receive timed out")] Timeout, |