use nostr_rs_types::Response;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("The identifier {0} is already in use")]
    IdentifierAlreadyUsed(String),

    #[error("Internal/DB: {0}")]
    Db(#[from] nostr_rs_storage::Error),

    #[error("WebSocket error: {0}")]
    WebSocket(#[from] tokio_tungstenite::tungstenite::Error),

    #[error("Serialization: {0}")]
    Serde(#[from] serde_json::Error),

    #[error("Unknown connection: {0}")]
    UnknownConnection(u128),

    #[error("TrySendError: {0}")]
    TrySendError(#[from] tokio::sync::mpsc::error::TrySendError<Response>),
}
