pub enum IntelApiError {
UnsupportedApiVersion(String),
Reqwest(Error),
UrlParse(ParseError),
JsonError(Error),
ApiError {
status: StatusCode,
request_id: String,
error_code: Option<String>,
error_message: Option<String>,
},
MissingOrInvalidHeader(&'static str),
InvalidSubscriptionKey,
ConflictingParameters(&'static str),
Io(Error),
HeaderValueParse(&'static str, String),
InvalidParameter(&'static str),
TooManyRequests {
request_id: String,
retry_after: u64,
},
}
Expand description
Represents all possible errors that can occur when interacting with Intel’s DCAP API.
Variants§
UnsupportedApiVersion(String)
Indicates that the requested API version or feature is unsupported.
Reqwest(Error)
Wraps an underlying reqwest error.
UrlParse(ParseError)
Wraps a URL parsing error.
JsonError(Error)
Wraps a Serde JSON error.
ApiError
Represents a general API error, capturing the HTTP status and optional error details.
Fields
status: StatusCode
HTTP status code returned by the API.
MissingOrInvalidHeader(&'static str)
Indicates that a header is missing or invalid.
InvalidSubscriptionKey
Represents an invalid subscription key.
ConflictingParameters(&'static str)
Indicates that conflicting parameters were supplied.
Io(Error)
Wraps a standard I/O error.
HeaderValueParse(&'static str, String)
Represents an error while parsing a header’s value.
InvalidParameter(&'static str)
Indicates an invalid parameter was provided.
TooManyRequests
Indicates that the API rate limit has been exceeded (HTTP 429).
This error is returned after the client has exhausted all automatic retry attempts
for a rate-limited request. The retry_after
field contains the number of seconds
that was specified in the last Retry-After header. By default, the client automatically
retries rate-limited requests up to 3 times.
§Example
use intel_dcap_api::{ApiClient, IntelApiError};
let mut client = ApiClient::new()?;
client.set_max_retries(0); // Disable automatic retries
match client.get_sgx_tcb_info("00606A000000", None, None).await {
Ok(tcb_info) => println!("Success"),
Err(IntelApiError::TooManyRequests { request_id, retry_after }) => {
println!("Rate limited after all retries. Last retry-after was {} seconds.", retry_after);
}
Err(e) => eprintln!("Other error: {}", e),
}
Trait Implementations§
Source§impl Debug for IntelApiError
impl Debug for IntelApiError
Source§impl Display for IntelApiError
impl Display for IntelApiError
Source§impl Error for IntelApiError
impl Error for IntelApiError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for IntelApiError
impl From<Error> for IntelApiError
Source§impl From<Error> for IntelApiError
impl From<Error> for IntelApiError
Source§impl From<Error> for IntelApiError
impl From<Error> for IntelApiError
Source§impl From<ParseError> for IntelApiError
impl From<ParseError> for IntelApiError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for IntelApiError
impl !RefUnwindSafe for IntelApiError
impl Send for IntelApiError
impl Sync for IntelApiError
impl Unpin for IntelApiError
impl !UnwindSafe for IntelApiError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.