Customers Error Response (errors/customers_error_response.rs)

hyperswitch · crates/router/src/core/errors/customers_error_response.rs · rust · Apache-2.0
payments, crm, integration, lang:rust, fw:actix, tag:error-handling

Defines error variants for customer-related API operations (redaction, not found, mandate active, access forbidden) and maps them to HTTP status codes via ResponseError trait.

// Source: https://github.com/juspay/hyperswitch | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
use http::StatusCode;

#[derive(Debug, thiserror::Error)]
pub enum CustomersErrorResponse {
    #[error("Customer has already been redacted")]
    CustomerRedacted,

    #[error("Something went wrong")]
    InternalServerError,

    #[error("Invalid request data: {message}")]
    InvalidRequestData { message: String },

    #[error("Customer has already been redacted")]
    MandateActive,

    #[error("Customer does not exist in our records")]
    CustomerNotFound,

    #[error("Customer with the given customer id already exists")]
    CustomerAlreadyExists,

    #[error("Access forbid

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key