cfdp_simplified/daemon/
error.rs

1use thiserror::Error;
2
3use crate::{filestore::FileStoreError, transaction::TransactionID};
4use tokio::sync::mpsc::error::SendError;
5
6use super::Command;
7
8pub type DaemonResult<T> = Result<T, DaemonError>;
9#[derive(Error, Debug)]
10pub enum DaemonError {
11    #[error("Error Spawning Send Transaction resulting from FileStore error: {0:}")]
12    SpawnSend(FileStoreError),
13
14    #[error("Error sending Command to Transaction {0}: {1}")]
15    TransactionCommunication(TransactionID, Command),
16
17    #[error(
18        "Unable to initialize Send transaction {0}.
19Received a PDU that identified this entity as the Sender.
20Not enough information to resume the transaction. "
21    )]
22    UnableToResume(TransactionID),
23}
24impl From<(TransactionID, SendError<Command>)> for DaemonError {
25    fn from(value: (TransactionID, SendError<Command>)) -> Self {
26        Self::TransactionCommunication(value.0, value.1 .0)
27    }
28}