pub(crate) type Result<T> = std::result::Result<T, Error>;
use super::ClientEvent;
use sn_registers::{Entry, EntryHash};
use std::collections::BTreeSet;
use thiserror::Error;
#[derive(Debug, Error)]
#[allow(missing_docs)]
pub enum Error {
#[error("Network Error {0}.")]
Network(#[from] sn_networking::Error),
#[error("Protocol error {0}.")]
Protocol(#[from] sn_protocol::error::Error),
#[error("Register error {0}.")]
Register(#[from] sn_registers::Error),
#[error("Events receiver error {0}.")]
EventsReceiver(#[from] tokio::sync::broadcast::error::RecvError),
#[error("Events sender error {0}.")]
EventsSender(#[from] tokio::sync::broadcast::error::SendError<ClientEvent>),
#[error("ResponseTimeout.")]
ResponseTimeout(#[from] tokio::time::error::Elapsed),
#[error("Unexpected responses")]
UnexpectedResponses,
#[error("Failed to verify transfer validity in the network {0}")]
CouldNotVerifyTransfer(String),
#[error("Chunks error {0}.")]
Chunks(#[from] super::chunks::Error),
#[error("Serialisation error: {0}")]
BincodeError(#[from] bincode::Error),
#[error(
"Content branches detected in the Register which need to be merged/resolved by user. \
Entries hashes of branches are: {0:?}"
)]
ContentBranchDetected(BTreeSet<(EntryHash, Entry)>),
}