Skip to main content

webfinger_rs/
error.rs

1use crate::ResourceError;
2
3/// Error type for this crate.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// An error occurred while performing an HTTP request.
7    #[error(transparent)]
8    Http(#[from] http::Error),
9
10    /// An error occurred while sending an HTTP request using `reqwest`.
11    #[cfg(feature = "reqwest")]
12    #[error(transparent)]
13    Reqwest(#[from] reqwest::Error),
14
15    /// An error occurred while parsing JSON.
16    // #[error("json error: {0}")]
17    // Json(#[from] serde_json::Error),
18    #[error("invalid uri: {0}")]
19    InvalidUri(#[from] http::uri::InvalidUri),
20
21    /// A WebFinger resource is malformed.
22    #[error(transparent)]
23    InvalidResource(#[from] ResourceError),
24
25    /// A WebFinger JRD field expected an absolute URI string.
26    #[error("invalid JRD URI: {0}")]
27    InvalidJrdUri(String),
28
29    /// A WebFinger relation type was not a URI or registered relation type.
30    #[error("invalid relation type: {0}")]
31    InvalidRel(String),
32}