stratum_server/
error.rs

1use crate::{ban_manager, session::SendInformation};
2use futures::channel::mpsc::SendError;
3
4#[derive(thiserror::Error, Debug)]
5pub enum Error {
6    #[error("Banned connection attempted to connect: {0}")]
7    ConnectionBanned(ban_manager::Key),
8    #[error("Session IDs Exhausted")]
9    SessionIDsExhausted,
10    //This is the result of a non-graceful shutdown from someone connecting.
11    #[error("Peer reset connection")]
12    PeerResetConnection,
13    #[error(transparent)]
14    Sender(#[from] tokio::sync::mpsc::error::SendError<SendInformation>),
15    #[error(transparent)]
16    Json(#[from] serde_json::error::Error),
17    #[error(transparent)]
18    Io(#[from] std::io::Error),
19    #[error(transparent)]
20    MesssageSend(#[from] SendError),
21    #[error(transparent)]
22    AddrParseError(#[from] std::net::AddrParseError),
23    #[cfg(feature = "api")]
24    #[error(transparent)]
25    API(#[from] crate::api::Error),
26
27    //Non-updated Errors
28    #[error("Stratum User not authorized")]
29    NotAuthorized,
30    #[error("Stratum Stream Closed. Reasion: {0}")]
31    StreamClosed(String),
32    #[error("Connection used wrong port in proxy protoocl")]
33    StreamWrongPort,
34    #[error("Method does not exist")]
35    MethodDoesntExist,
36    #[error("Can't break ExMessage header - Not complete")]
37    BrokenExHeader,
38    //@todo double cehck this covers it, and doesn't just feature gate the tranpsarent part.
39    //@todo shutdown error.
40    // #[error("Timeout Error: {0}")]
41    // TimedOut(#[from] CancellationToken),
42}