Skip to main content

cloud_sdk/client/
error.rs

1use core::fmt;
2
3use crate::operation::PreparedExecutionError;
4
5/// Failure across preparation, authenticated execution, or checked decoding.
6pub enum ClientExecutionError<P, T, D> {
7    /// Provider request preparation failed before transport access.
8    Preparation(P),
9    /// Endpoint, authorization, transport, or response admission failed.
10    Execution(PreparedExecutionError<T>),
11    /// Provider-specific checked decoding failed.
12    Decode(D),
13}
14
15impl<P, T, D> fmt::Debug for ClientExecutionError<P, T, D> {
16    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
17        formatter.write_str(match self {
18            Self::Preparation(_) => "ClientExecutionError::Preparation([redacted])",
19            Self::Execution(_) => "ClientExecutionError::Execution([redacted])",
20            Self::Decode(_) => "ClientExecutionError::Decode([redacted])",
21        })
22    }
23}
24
25impl<P, T, D> fmt::Display for ClientExecutionError<P, T, D> {
26    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
27        formatter.write_str(match self {
28            Self::Preparation(_) => "client request preparation failed",
29            Self::Execution(_) => "client request execution failed",
30            Self::Decode(_) => "client response decoding failed",
31        })
32    }
33}
34
35impl<P, T, D> core::error::Error for ClientExecutionError<P, T, D> {}