Skip to main content

authn_resolver_sdk/
error.rs

1//! Error types for the `AuthN` resolver module.
2
3use thiserror::Error;
4
5/// Errors that can occur when using the `AuthN` resolver API.
6#[derive(Debug, Error)]
7pub enum AuthNResolverError {
8    /// The token is invalid, expired, or malformed.
9    #[error("unauthorized: {0}")]
10    Unauthorized(String),
11
12    /// No `AuthN` plugin is available to handle the request.
13    #[error("no plugin available")]
14    NoPluginAvailable,
15
16    /// The plugin is not available yet.
17    #[error("service unavailable: {0}")]
18    ServiceUnavailable(String),
19
20    /// Client credentials exchange failed (e.g., invalid credentials,
21    /// `IdP` unreachable, token endpoint error).
22    #[error("token acquisition failed: {0}")]
23    TokenAcquisitionFailed(String),
24
25    /// An internal error occurred.
26    #[error("internal error: {0}")]
27    Internal(String),
28}