forked from
smokesignal.events/smokesignal
i18n+filtering fork - fluent-templates v2
1use thiserror::Error;
2
3/// Represents errors that can occur during OAuth client operations.
4///
5/// These errors are related to the OAuth client functionality, including
6/// interacting with authorization servers, protected resources, and token management.
7#[derive(Debug, Error)]
8pub enum OAuthClientError {
9 /// Error when a request to the authorization server fails.
10 ///
11 /// This error occurs when the OAuth client fails to establish a connection
12 /// or complete a request to the authorization server.
13 #[error("error-oauth-client-1 Authorization Server Request Failed: {0:?}")]
14 AuthorizationServerRequestFailed(reqwest::Error),
15
16 /// Error when the authorization server response is malformed.
17 ///
18 /// This error occurs when the response from the authorization server
19 /// cannot be properly parsed or processed.
20 #[error("error-oauth-client-2 Malformed Authorization Server Response: {0:?}")]
21 MalformedAuthorizationServerResponse(reqwest::Error),
22
23 /// Error when the authorization server response is invalid.
24 ///
25 /// This error occurs when the response from the authorization server
26 /// is well-formed but contains invalid or unexpected data.
27 #[error("error-oauth-client-3 Invalid Authorization Server Response: {0:?}")]
28 InvalidAuthorizationServerResponse(anyhow::Error),
29
30 /// Error when an OAuth protected resource is invalid.
31 ///
32 /// This error occurs when trying to access a protected resource that
33 /// is not properly configured for OAuth access.
34 #[error("error-oauth-client-4 Invalid OAuth Protected Resource")]
35 InvalidOAuthProtectedResource,
36
37 /// Error when a request to an OAuth protected resource fails.
38 ///
39 /// This error occurs when the OAuth client fails to establish a connection
40 /// or complete a request to a protected resource.
41 #[error("error-oauth-client-5 OAuth Protected Resource Request Failed: {0:?}")]
42 OAuthProtectedResourceRequestFailed(reqwest::Error),
43
44 /// Error when a protected resource response is malformed.
45 ///
46 /// This error occurs when the response from a protected resource
47 /// cannot be properly parsed or processed.
48 #[error("error-oauth-client-6 Malformed OAuth Protected Resource Response: {0:?}")]
49 MalformedOAuthProtectedResourceResponse(reqwest::Error),
50
51 /// Error when a protected resource response is invalid.
52 ///
53 /// This error occurs when the response from a protected resource
54 /// is well-formed but contains invalid or unexpected data.
55 #[error("error-oauth-client-7 Invalid OAuth Protected Resource Response: {0:?}")]
56 InvalidOAuthProtectedResourceResponse(anyhow::Error),
57
58 /// Error when a PAR middleware request fails.
59 ///
60 /// This error occurs when a Pushed Authorization Request (PAR) middleware
61 /// request fails to complete successfully.
62 #[error("error-oauth-client-8 PAR Middleware Request Failed: {0:?}")]
63 PARMiddlewareRequestFailed(reqwest_middleware::Error),
64
65 /// Error when a PAR request fails.
66 ///
67 /// This error occurs when a Pushed Authorization Request (PAR)
68 /// fails to be properly processed by the authorization server.
69 #[error("error-oauth-client-9 PAR Request Failed: {0:?}")]
70 PARRequestFailed(reqwest::Error),
71
72 /// Error when a PAR response is malformed.
73 ///
74 /// This error occurs when the response from a Pushed Authorization
75 /// Request (PAR) cannot be properly parsed or processed.
76 #[error("error-oauth-client-10 Malformed PAR Response: {0:?}")]
77 MalformedPARResponse(reqwest::Error),
78
79 /// Error when token minting fails.
80 ///
81 /// This error occurs when the system fails to mint (create) a new
82 /// OAuth token, typically due to cryptographic or validation issues.
83 #[error("error-oauth-client-11 Token minting failed: {0:?}")]
84 MintTokenFailed(anyhow::Error),
85
86 /// Error when a token response is malformed.
87 ///
88 /// This error occurs when the response containing a token cannot
89 /// be properly parsed or processed.
90 #[error("error-oauth-client-12 Malformed Token Response: {0:?}")]
91 MalformedTokenResponse(reqwest::Error),
92
93 /// Error when a token middleware request fails.
94 ///
95 /// This error occurs when a token-related middleware request
96 /// fails to complete successfully.
97 #[error("error-oauth-client-13 Token Request Failed: {0:?}")]
98 TokenMiddlewareRequestFailed(reqwest_middleware::Error),
99}