Skip to main content

aptos_client_icp/models/
aptos_error_code.rs

1/*
2 * Aptos Node API
3 *
4 * The Aptos Node API is a RESTful API for client applications to interact with the Aptos blockchain.
5 *
6 * The version of the OpenAPI document: 1.2.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// AptosErrorCode : These codes provide more granular error information beyond just the HTTP status code of the response.
15/// These codes provide more granular error information beyond just the HTTP status code of the response.
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum AptosErrorCode {
18    #[serde(rename = "account_not_found")]
19    AccountNotFound,
20    #[serde(rename = "resource_not_found")]
21    ResourceNotFound,
22    #[serde(rename = "module_not_found")]
23    ModuleNotFound,
24    #[serde(rename = "struct_field_not_found")]
25    StructFieldNotFound,
26    #[serde(rename = "version_not_found")]
27    VersionNotFound,
28    #[serde(rename = "transaction_not_found")]
29    TransactionNotFound,
30    #[serde(rename = "table_item_not_found")]
31    TableItemNotFound,
32    #[serde(rename = "block_not_found")]
33    BlockNotFound,
34    #[serde(rename = "state_value_not_found")]
35    StateValueNotFound,
36    #[serde(rename = "version_pruned")]
37    VersionPruned,
38    #[serde(rename = "block_pruned")]
39    BlockPruned,
40    #[serde(rename = "invalid_input")]
41    InvalidInput,
42    #[serde(rename = "invalid_transaction_update")]
43    InvalidTransactionUpdate,
44    #[serde(rename = "sequence_number_too_old")]
45    SequenceNumberTooOld,
46    #[serde(rename = "vm_error")]
47    VmError,
48    #[serde(rename = "health_check_failed")]
49    HealthCheckFailed,
50    #[serde(rename = "mempool_is_full")]
51    MempoolIsFull,
52    #[serde(rename = "internal_error")]
53    InternalError,
54    #[serde(rename = "web_framework_error")]
55    WebFrameworkError,
56    #[serde(rename = "bcs_not_supported")]
57    BcsNotSupported,
58    #[serde(rename = "api_disabled")]
59    ApiDisabled,
60
61}
62
63impl std::fmt::Display for AptosErrorCode {
64    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
65        match self {
66            Self::AccountNotFound => write!(f, "account_not_found"),
67            Self::ResourceNotFound => write!(f, "resource_not_found"),
68            Self::ModuleNotFound => write!(f, "module_not_found"),
69            Self::StructFieldNotFound => write!(f, "struct_field_not_found"),
70            Self::VersionNotFound => write!(f, "version_not_found"),
71            Self::TransactionNotFound => write!(f, "transaction_not_found"),
72            Self::TableItemNotFound => write!(f, "table_item_not_found"),
73            Self::BlockNotFound => write!(f, "block_not_found"),
74            Self::StateValueNotFound => write!(f, "state_value_not_found"),
75            Self::VersionPruned => write!(f, "version_pruned"),
76            Self::BlockPruned => write!(f, "block_pruned"),
77            Self::InvalidInput => write!(f, "invalid_input"),
78            Self::InvalidTransactionUpdate => write!(f, "invalid_transaction_update"),
79            Self::SequenceNumberTooOld => write!(f, "sequence_number_too_old"),
80            Self::VmError => write!(f, "vm_error"),
81            Self::HealthCheckFailed => write!(f, "health_check_failed"),
82            Self::MempoolIsFull => write!(f, "mempool_is_full"),
83            Self::InternalError => write!(f, "internal_error"),
84            Self::WebFrameworkError => write!(f, "web_framework_error"),
85            Self::BcsNotSupported => write!(f, "bcs_not_supported"),
86            Self::ApiDisabled => write!(f, "api_disabled"),
87        }
88    }
89}
90
91impl Default for AptosErrorCode {
92    fn default() -> AptosErrorCode {
93        Self::AccountNotFound
94    }
95}
96