impl Display for UiaaResponse

This commit is contained in:
Jonas Platte 2020-04-30 15:28:42 +02:00
parent 5a26c38764
commit 5aef537582
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -1,6 +1,9 @@
//! Module for User-Interactive Authentication API types.
use std::collections::BTreeMap;
use std::{
collections::BTreeMap,
fmt::{self, Display, Formatter},
};
use ruma_api::{error::ResponseDeserializationError, EndpointError};
use serde::{Deserialize, Serialize};
@ -74,6 +77,15 @@ pub enum UiaaResponse {
MatrixError(MatrixError),
}
impl Display for UiaaResponse {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::AuthResponse(_) => write!(f, "User-Interactive Authentication required."),
Self::MatrixError(err) => write!(f, "{}", err),
}
}
}
impl From<MatrixError> for UiaaResponse {
fn from(error: MatrixError) -> Self {
Self::MatrixError(error)