Skip to main content

opensearch_client/common/
error_cause.rs

1/*
2 * opensearch-client
3 *
4 * Rust Client for OpenSearch
5 *
6 * The version of the OpenAPI document: 3.1.0
7 * Contact: alberto.paro@gmail.com
8 * Generated by Paro OpenAPI Generator
9 */
10
11use crate::common;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ErrorCause {
16    #[serde(rename = "caused_by", default, skip_serializing_if = "Option::is_none")]
17    pub caused_by: Option<Box<common::ErrorCause>>,
18    /// A human-readable explanation of the error, in English.
19    #[serde(rename = "reason", default, skip_serializing_if = "Option::is_none")]
20    pub reason: Option<String>,
21    #[serde(
22        rename = "root_cause",
23        default,
24        skip_serializing_if = "Option::is_none"
25    )]
26    pub root_cause: Option<Vec<Box<common::ErrorCause>>>,
27    #[serde(
28        rename = "suppressed",
29        default,
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub suppressed: Option<Vec<Box<common::ErrorCause>>>,
33    /// The type of error.
34    #[serde(rename = "type")]
35    pub r#type: String,
36    /// The server stack trace, present only if the `error_trace=true` parameter was sent with the request.
37    #[serde(
38        rename = "stack_trace",
39        default,
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub stack_trace: Option<String>,
43}
44
45impl ErrorCause {
46    pub fn new(r#type: String) -> ErrorCause {
47        ErrorCause {
48            caused_by: None,
49            reason: None,
50            root_cause: None,
51            suppressed: None,
52            r#type,
53            stack_trace: None,
54        }
55    }
56}