moves code into the api layer

This commit is contained in:
2025-12-30 01:54:39 -05:00
parent 8d737e8f33
commit 29f7f6d83b
14 changed files with 444 additions and 286 deletions

31
api/src/client/error.rs Normal file
View File

@@ -0,0 +1,31 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ConnectError {
#[error(transparent)]
TungsteniteError(#[from] tokio_tungstenite::tungstenite::Error),
#[error(transparent)]
IoError(#[from] std::io::Error),
}
#[derive(Error, Debug)]
pub enum MessageError {
#[error(transparent)]
TokioSendError(#[from] tokio::sync::mpsc::error::SendError<()>),
#[error(transparent)]
TokioTrySendError(#[from] tokio::sync::mpsc::error::TrySendError<()>),
#[error(transparent)]
TokioLockError(#[from] tokio::sync::TryLockError),
}
#[derive(Error, Debug)]
pub enum RequestError<E> {
#[error(transparent)]
TokioSendError(#[from] tokio::sync::mpsc::error::SendError<()>),
#[error(transparent)]
TokioLockError(#[from] tokio::sync::TryLockError),
#[error(transparent)]
RecvError(#[from] tokio::sync::oneshot::error::RecvError),
#[error(transparent)]
Inner(E),
}