tonic_richer_error/
error_details_vec.rs

1use super::std_messages::*;
2
3/// Wraps the structs corresponding to the standard error messages, allowing
4/// the implementation and handling of vectors containing any of them.
5#[derive(Clone, Debug)]
6pub enum ErrorDetail {
7    /// Wraps the [`RetryInfo`] struct.
8    RetryInfo(RetryInfo),
9
10    /// Wraps the [`DebugInfo`] struct.
11    DebugInfo(DebugInfo),
12
13    /// Wraps the [`QuotaFailure`] struct.
14    QuotaFailure(QuotaFailure),
15
16    /// Wraps the [`ErrorInfo`] struct.
17    ErrorInfo(ErrorInfo),
18
19    /// Wraps the [`PreconditionFailure`] struct.
20    PreconditionFailure(PreconditionFailure),
21
22    /// Wraps the [`BadRequest`] struct.
23    BadRequest(BadRequest),
24
25    /// Wraps the [`RequestInfo`] struct.
26    RequestInfo(RequestInfo),
27
28    /// Wraps the [`ResourceInfo`] struct.
29    ResourceInfo(ResourceInfo),
30
31    /// Wraps the [`Help`] struct.
32    Help(Help),
33
34    /// Wraps the [`LocalizedMessage`] struct.
35    LocalizedMessage(LocalizedMessage),
36}
37
38impl From<RetryInfo> for ErrorDetail {
39    fn from(err_detail: RetryInfo) -> Self {
40        ErrorDetail::RetryInfo(err_detail)
41    }
42}
43
44impl From<DebugInfo> for ErrorDetail {
45    fn from(err_detail: DebugInfo) -> Self {
46        ErrorDetail::DebugInfo(err_detail)
47    }
48}
49
50impl From<QuotaFailure> for ErrorDetail {
51    fn from(err_detail: QuotaFailure) -> Self {
52        ErrorDetail::QuotaFailure(err_detail)
53    }
54}
55
56impl From<ErrorInfo> for ErrorDetail {
57    fn from(err_detail: ErrorInfo) -> Self {
58        ErrorDetail::ErrorInfo(err_detail)
59    }
60}
61
62impl From<PreconditionFailure> for ErrorDetail {
63    fn from(err_detail: PreconditionFailure) -> Self {
64        ErrorDetail::PreconditionFailure(err_detail)
65    }
66}
67
68impl From<BadRequest> for ErrorDetail {
69    fn from(err_detail: BadRequest) -> Self {
70        ErrorDetail::BadRequest(err_detail)
71    }
72}
73
74impl From<RequestInfo> for ErrorDetail {
75    fn from(err_detail: RequestInfo) -> Self {
76        ErrorDetail::RequestInfo(err_detail)
77    }
78}
79
80impl From<ResourceInfo> for ErrorDetail {
81    fn from(err_detail: ResourceInfo) -> Self {
82        ErrorDetail::ResourceInfo(err_detail)
83    }
84}
85
86impl From<Help> for ErrorDetail {
87    fn from(err_detail: Help) -> Self {
88        ErrorDetail::Help(err_detail)
89    }
90}
91
92impl From<LocalizedMessage> for ErrorDetail {
93    fn from(err_detail: LocalizedMessage) -> Self {
94        ErrorDetail::LocalizedMessage(err_detail)
95    }
96}