aboutsummaryrefslogtreecommitdiffstats
path: root/lampada/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lampada/src/error.rs')
-rw-r--r--lampada/src/error.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/lampada/src/error.rs b/lampada/src/error.rs
index 8104155..9ca5f12 100644
--- a/lampada/src/error.rs
+++ b/lampada/src/error.rs
@@ -1,11 +1,18 @@
+// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
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 +28,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 +66,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,