celestia_rpc/error.rs
1/// Alias for a `Result` with the error type [`celestia_rpc::Error`].
2///
3/// [`celestia_rpc::Error`]: crate::Error
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Representation of all the errors that can occur when interacting with [`celestia_rpc`].
7///
8/// [`celestia_rpc`]: crate
9#[derive(Debug, thiserror::Error)]
10pub enum Error {
11 /// Invalid characters in the auth token.
12 #[cfg(not(target_arch = "wasm32"))]
13 #[error("Token contains invalid characters: {0}")]
14 InvalidCharactersInToken(#[from] http::header::InvalidHeaderValue),
15
16 /// Protocol specified in connection string is not supported.
17 #[error("Protocol not supported or missing: {0}")]
18 ProtocolNotSupported(String),
19
20 /// Error propagated from the [`jsonrpsee`].
21 #[error(transparent)]
22 JsonRpc(#[from] jsonrpsee::core::ClientError),
23
24 /// Provided timeout is out of range
25 #[error("Out of range timeout value")]
26 TimeoutOutOfRange,
27}