1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Create the AccountManagementError enum

Otherwise it forces dependant crates to add serde_urlencoded as a dependency
just to be able to forward the error type.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille
2024-04-02 15:56:13 +02:00
committed by Quentin Gliech
parent b342870db9
commit d3d11594f3
2 changed files with 14 additions and 1 deletions

View File

@@ -64,6 +64,9 @@ pub enum Error {
/// An error occurred introspecting a token.
Introspection(#[from] IntrospectionError),
/// An error occurred building the account management URL.
AccountManagement(#[from] AccountManagementError),
}
/// All possible errors when fetching provider metadata.
@@ -703,3 +706,11 @@ pub enum CredentialsError {
#[error(transparent)]
Custom(BoxError),
}
/// All errors that can occur when building the account management URL.
#[derive(Debug, Error)]
pub enum AccountManagementError {
/// An error occurred serializing the parameters.
#[error(transparent)]
UrlEncoded(#[from] serde_urlencoded::ser::Error),
}

View File

@@ -20,6 +20,8 @@ use serde::Serialize;
use serde_with::skip_serializing_none;
use url::Url;
use crate::error::AccountManagementError;
/// An account management action that a user can take, including a device ID for
/// the actions that support it.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
@@ -101,7 +103,7 @@ pub fn build_account_management_url(
mut account_management_uri: Url,
action: Option<AccountManagementActionFull>,
id_token_hint: Option<String>,
) -> Result<Url, serde_urlencoded::ser::Error> {
) -> Result<Url, AccountManagementError> {
let data = AccountManagementData {
action,
id_token_hint,