pdk-contracts-lib 1.10.0

PDK Contracts Library
Documentation
// Copyright (c) 2026, Salesforce, Inc.,
// All rights reserved.
// For full license text, see the LICENSE.txt file

use pdk_core::classy::hl::HttpClientError;

/// Error returned when authentication fails.
#[non_exhaustive]
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
pub enum AuthenticationError {
    /// Client ID does not match.
    #[error("Client ID does not match.")]
    InvalidClientId,

    /// Client Secret does not match.
    #[error("Client Secret does not match.")]
    InvalidClientSecret,

    ///Contract does not have client_secret configured; client credentials authentication is not supported for this contract.
    #[error("Contract does not have client_secret configured; client credentials authentication is not supported for this contract.")]
    ContractHasNoClientSecret,

    /// Contracts are unavailable.
    #[error("Contracts are unavailable.")]
    UnavailableContracts,
}

/// Error returned when authorization fails.
#[non_exhaustive]
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
pub enum AuthorizationError {
    /// Client ID does not match.
    #[error("Client ID does not match.")]
    InvalidClientId,

    /// Contracts are unavailable.
    #[error("Contracts are unavailable.")]
    UnavailableContracts,
}

/// Error returned when updating contracts fails.
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum UpdateError {
    /// Contracts upstream login problem.
    #[error("Contracts upstream login problem.")]
    InvalidLogin(HttpClientError),

    /// Contracts upstream request problem.
    #[error("Contracts upstream request problem.")]
    InvalidRequest(HttpClientError),
}