diff --git a/src/r0/uiaa.rs b/src/r0/uiaa.rs index 3caa8afa..14b7a97a 100644 --- a/src/r0/uiaa.rs +++ b/src/r0/uiaa.rs @@ -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 for UiaaResponse { fn from(error: MatrixError) -> Self { Self::MatrixError(error)