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    /// A non-empty body omitted its required explicit content type.
44    MissingContentType,
45    /// A validated header could not be represented by the HTTP implementation.
46    HeaderRejected,
47    /// Adapter-owned request-body allocation failed.
48    RequestBodyAllocationFailed,
49    /// The request body length cannot be represented by the HTTP client.
50    RequestBodyTooLarge,
51    /// Adapter-owned response-body allocation failed.
52    ResponseBodyAllocationFailed,
53    /// Connection establishment failed.
54    ConnectFailed,
55    /// The configured request or read deadline expired.
56    TimedOut,
57    /// Sending failed for another payload-free reason.
58    RequestFailed,
59    /// The response status is outside the core SDK's admitted HTTP range.
60    InvalidStatus,
61    /// Rate-limit response headers were incomplete, non-decimal, or incoherent.
62    InvalidRateLimitHeaders,
63    /// The declared or observed response body exceeds the caller buffer.
64    ResponseTooLarge,
65    /// Reading the response body failed.
66    ResponseReadFailed,
67    /// The final response origin differed from the configured endpoint.
68    ResponseOriginChanged,
69}
70
71impl_static_error!(TransportError,
72    Self::CredentialStateUnavailable => "credential state is unavailable",
73    Self::TargetRejected => "request target was rejected",
74    Self::MissingContentType => "request body content type is missing",
75    Self::HeaderRejected => "request header was rejected",
76    Self::RequestBodyAllocationFailed => "request-body allocation failed",
77    Self::RequestBodyTooLarge => "request body is too large",
78    Self::ResponseBodyAllocationFailed => "response-body allocation failed",
79    Self::ConnectFailed => "connection failed",
80    Self::TimedOut => "request timed out",
81    Self::RequestFailed => "request failed",
82    Self::InvalidStatus => "response status is invalid",
83    Self::InvalidRateLimitHeaders => "rate-limit headers are invalid",
84    Self::ResponseTooLarge => "response body exceeds the caller limit",
85    Self::ResponseReadFailed => "response body read failed",
86    Self::ResponseOriginChanged => "response origin changed",
87);