1use thiserror::Error;
4
5#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum Error {
9 #[error("invalid URL: {0}")]
11 InvalidUrl(#[from] url::ParseError),
12
13 #[error("requested NodeInfo version {requested} not advertised by server")]
15 VersionNotAdvertised {
16 requested: &'static str,
18 },
19
20 #[cfg(feature = "client")]
22 #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
23 #[error("HTTP error: {0}")]
24 Http(#[from] reqwest::Error),
25
26 #[cfg(feature = "client")]
28 #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
29 #[error("NodeInfo server returned status {0}")]
30 BadStatus(u16),
31
32 #[cfg(feature = "client")]
37 #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
38 #[error("NodeInfo response body exceeds the {0}-byte limit")]
39 ResponseTooLarge(u64),
40
41 #[error("JSON error: {0}")]
43 Json(#[from] serde_json::Error),
44}