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