api: Move UnknownVersionError
into error module
This commit is contained in:
parent
1e900ab58c
commit
fe337f8d5b
@ -221,3 +221,16 @@ pub enum HeaderDeserializationError {
|
||||
#[error("Missing header `{0}`")]
|
||||
MissingHeader(String),
|
||||
}
|
||||
|
||||
/// An error that happens when Ruma cannot understand a Matrix version.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct UnknownVersionError;
|
||||
|
||||
impl fmt::Display for UnknownVersionError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Version string was unknown.")
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for UnknownVersionError {}
|
||||
|
@ -214,7 +214,7 @@ pub mod exports {
|
||||
pub use serde_json;
|
||||
}
|
||||
|
||||
use error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError};
|
||||
use error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError, UnknownVersionError};
|
||||
|
||||
/// An enum to control whether an access token should be added to outgoing requests
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
@ -487,19 +487,6 @@ pub enum MatrixVersion {
|
||||
V1_2,
|
||||
}
|
||||
|
||||
/// An error that happens when Ruma cannot understand a Matrix version.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct UnknownVersionError;
|
||||
|
||||
impl Display for UnknownVersionError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Version string was unknown.")
|
||||
}
|
||||
}
|
||||
|
||||
impl StdError for UnknownVersionError {}
|
||||
|
||||
impl TryFrom<&str> for MatrixVersion {
|
||||
type Error = UnknownVersionError;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user