matrix_oracle/server/
error.rs

1//! Errors that can occur when performing a well-known lookup.
2
3/// The result of attempting to perform well-known lookup.
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Errors that can happen when attempting to perform well-known lookup.
7#[derive(Debug)]
8pub enum Error {
9	/// An error happened while fetching an HTTP request.
10	Http(reqwest::Error),
11}
12
13impl std::fmt::Display for Error {
14	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15		match self {
16			Self::Http(http) => write!(f, "{}", http),
17		}
18	}
19}
20
21impl std::error::Error for Error {
22	fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
23		match *self {
24			Self::Http(ref err) => Some(err),
25		}
26	}
27}
28
29impl From<reqwest::Error> for Error {
30	fn from(err: reqwest::Error) -> Self {
31		Self::Http(err)
32	}
33}