Skip to main content

cloud_sdk_reqwest/shared/
error.rs

1/// Client construction failure.
2#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3pub enum BuildError {
4    /// FIPS transport construction omitted its required trust and revocation policy.
5    FipsTlsPolicyRequired,
6    /// The FIPS trust policy contained no trust anchors.
7    FipsTrustRootsRequired,
8    /// The FIPS trust policy contained no certificate revocation lists.
9    FipsCertificateRevocationListsRequired,
10    /// The selected cryptographic provider did not report FIPS operation.
11    FipsProviderRejected,
12    /// Rustls could not enable its safe protocol-version set for the FIPS provider.
13    FipsProtocolConfigurationFailed,
14    /// The chain-wide, fail-closed certificate revocation verifier could not be configured.
15    FipsRevocationVerifierFailed,
16    /// The complete TLS client configuration did not report FIPS operation.
17    FipsClientConfigurationRejected,
18    /// Rustls could not enable its safe protocol-version set for deterministic roots.
19    WebPkiRootsProtocolConfigurationFailed,
20    /// Reqwest rejected the fixed hardened client configuration.
21    ClientBuildFailed,
22}
23
24impl_static_error!(BuildError,
25    Self::FipsTlsPolicyRequired => "FIPS TLS policy is required",
26    Self::FipsTrustRootsRequired => "FIPS trust roots are required",
27    Self::FipsCertificateRevocationListsRequired => "FIPS revocation lists are required",
28    Self::FipsProviderRejected => "cryptographic provider did not report FIPS operation",
29    Self::FipsProtocolConfigurationFailed => "FIPS protocol configuration failed",
30    Self::FipsRevocationVerifierFailed => "FIPS revocation verifier configuration failed",
31    Self::FipsClientConfigurationRejected => "TLS client did not report FIPS operation",
32    Self::WebPkiRootsProtocolConfigurationFailed => "web PKI protocol configuration failed",
33    Self::ClientBuildFailed => "HTTP client construction failed",
34);
35
36/// Payload-free transport failure.
37#[derive(Clone, Copy, Debug, Eq, PartialEq)]
38pub enum TransportError {
39    /// The shared credential state could not be read safely.
40    CredentialStateUnavailable,
41    /// The target could not be composed without parsing or normalization.
42    TargetRejected,
43    /// The validated SDK method could not be represented by the HTTP implementation.
44    MethodRejected,
45    /// A non-empty body omitted its required explicit content type.
46    MissingContentType,
47    /// A validated header could not be represented by the HTTP implementation.
48    HeaderRejected,
49    /// Adapter-owned request-body allocation failed.
50    RequestBodyAllocationFailed,
51    /// The request body length cannot be represented by the HTTP client.
52    RequestBodyTooLarge,
53    /// Adapter-owned response-body allocation failed.
54    ResponseBodyAllocationFailed,
55    /// Connection establishment failed.
56    ConnectFailed,
57    /// The configured request or read deadline expired.
58    TimedOut,
59    /// Sending failed for another payload-free reason.
60    RequestFailed,
61    /// The response status is outside the core SDK's admitted HTTP range.
62    InvalidStatus,
63    /// Rate-limit response headers were incomplete, non-decimal, or incoherent.
64    InvalidRateLimitHeaders,
65    /// The response content type was duplicated, non-textual, or malformed.
66    InvalidResponseContentType,
67    /// The declared or observed response body exceeds the caller buffer.
68    ResponseTooLarge,
69    /// Reading the response body failed.
70    ResponseReadFailed,
71    /// The final response origin differed from the configured endpoint.
72    ResponseOriginChanged,
73}
74
75impl_static_error!(TransportError,
76    Self::CredentialStateUnavailable => "credential state is unavailable",
77    Self::TargetRejected => "request target was rejected",
78    Self::MethodRejected => "request method was rejected",
79    Self::MissingContentType => "request body content type is missing",
80    Self::HeaderRejected => "request header was rejected",
81    Self::RequestBodyAllocationFailed => "request-body allocation failed",
82    Self::RequestBodyTooLarge => "request body is too large",
83    Self::ResponseBodyAllocationFailed => "response-body allocation failed",
84    Self::ConnectFailed => "connection failed",
85    Self::TimedOut => "request timed out",
86    Self::RequestFailed => "request failed",
87    Self::InvalidStatus => "response status is invalid",
88    Self::InvalidRateLimitHeaders => "rate-limit headers are invalid",
89    Self::InvalidResponseContentType => "response content type is invalid",
90    Self::ResponseTooLarge => "response body exceeds the caller limit",
91    Self::ResponseReadFailed => "response body read failed",
92    Self::ResponseOriginChanged => "response origin changed",
93);