square_api_client/models/errors/
error.rs

1//! Model struct for Error type
2
3use serde::{Deserialize, Serialize};
4
5use crate::models::enums::{ErrorCategory, ErrorCode};
6
7/// Represents an error encountered during a request to the Connect API.
8///
9/// See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more
10/// information.
11#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
12pub struct Error {
13    /// Indicates which high-level category of error has occurred during a request to the Connect
14    /// API.
15    pub category: ErrorCategory,
16    /// Indicates the specific error that occurred during a request to a Square API.
17    pub code: ErrorCode,
18    /// A human-readable description of the error for debugging purposes.
19    pub detail: String,
20    /// The name of the field provided in the original request (if any) that the error pertains to.
21    /// This is an optional field as it would be absent on errors like - Invalid Authentication token
22    pub field: Option<String>,
23}