1#[derive(Debug)]
2pub enum NostrRelayError {
3 Tungstenite(Box<tokio_tungstenite::tungstenite::Error>),
4 Serde(serde_json::Error),
5 TokioSend(Box<tokio::sync::broadcast::error::SendError<nostro2::NostrClientEvent>>),
6 SendError,
7}
8impl std::fmt::Display for NostrRelayError {
9 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10 write!(f, "NostrRelayError: {self:#?}")
11 }
12}
13impl From<tokio_tungstenite::tungstenite::Error> for NostrRelayError {
14 fn from(value: tokio_tungstenite::tungstenite::Error) -> Self {
15 Self::Tungstenite(Box::new(value))
16 }
17}
18impl From<tokio::sync::broadcast::error::SendError<nostro2::NostrClientEvent>> for NostrRelayError {
19 fn from(value: tokio::sync::broadcast::error::SendError<nostro2::NostrClientEvent>) -> Self {
20 Self::TokioSend(Box::new(value))
21 }
22}
23
24impl std::error::Error for NostrRelayError {}