Skip to main content

aptos_client_icp/models/
aptos_error.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/// AptosError : This is the generic struct we use for all API errors, it contains a string message and an Aptos API specific error code.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct AptosError {
17    /// A message describing the error
18    #[serde(rename = "message")]
19    pub message: String,
20    #[serde(rename = "error_code")]
21    pub error_code: models::AptosErrorCode,
22    /// A code providing VM error details when submitting transactions to the VM
23    #[serde(rename = "vm_error_code", skip_serializing_if = "Option::is_none")]
24    pub vm_error_code: Option<i32>,
25}
26
27impl AptosError {
28    /// This is the generic struct we use for all API errors, it contains a string message and an Aptos API specific error code.
29    pub fn new(message: String, error_code: models::AptosErrorCode) -> AptosError {
30        AptosError {
31            message,
32            error_code,
33            vm_error_code: None,
34        }
35    }
36}
37