Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit d3d1159

Browse files
zecakehsandhose
authored andcommitted
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 <[email protected]>
1 parent b342870 commit d3d1159

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/oidc-client/src/error.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ pub enum Error {
6464

6565
/// An error occurred introspecting a token.
6666
Introspection(#[from] IntrospectionError),
67+
68+
/// An error occurred building the account management URL.
69+
AccountManagement(#[from] AccountManagementError),
6770
}
6871

6972
/// All possible errors when fetching provider metadata.
@@ -703,3 +706,11 @@ pub enum CredentialsError {
703706
#[error(transparent)]
704707
Custom(BoxError),
705708
}
709+
710+
/// All errors that can occur when building the account management URL.
711+
#[derive(Debug, Error)]
712+
pub enum AccountManagementError {
713+
/// An error occurred serializing the parameters.
714+
#[error(transparent)]
715+
UrlEncoded(#[from] serde_urlencoded::ser::Error),
716+
}

crates/oidc-client/src/requests/account_management.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use serde::Serialize;
2020
use serde_with::skip_serializing_none;
2121
use url::Url;
2222

23+
use crate::error::AccountManagementError;
24+
2325
/// An account management action that a user can take, including a device ID for
2426
/// the actions that support it.
2527
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
@@ -101,7 +103,7 @@ pub fn build_account_management_url(
101103
mut account_management_uri: Url,
102104
action: Option<AccountManagementActionFull>,
103105
id_token_hint: Option<String>,
104-
) -> Result<Url, serde_urlencoded::ser::Error> {
106+
) -> Result<Url, AccountManagementError> {
105107
let data = AccountManagementData {
106108
action,
107109
id_token_hint,

0 commit comments

Comments
 (0)