Enum ApiClientError

Source
pub enum ApiClientError {
Show 22 variants ReqwestError(Error), UrlError(ParseError), HeadersError(Error), HttpError(Error), InvalidHeaderName(InvalidHeaderName), InvalidHeaderValue(InvalidHeaderValue), JsonValueError(Error), QuerySerializationError(Error), AuthenticationError(AuthenticationError), CallResultRequired, InvalidBasePath { error: String, }, JsonError { path: String, error: Error, body: String, }, UnsupportedJsonOutput { output: Output, name: &'static str, }, UnsupportedTextOutput { output: Output, }, UnsupportedBytesOutput { output: Output, }, PathUnresolved { path: String, missings: Vec<String>, }, UnsupportedQueryParameterValue { value: Value, }, UnsupportedParameterValue { message: String, value: Value, }, MissingOperation { id: String, }, ServerFailure { raw_body: String, }, SerializationError { message: String, }, UnexpectedStatusCode { status_code: u16, body: String, },
}
Expand description

Errors that can occur when using the ApiClient.

This enum covers all possible error conditions from network issues to data validation failures. All variants implement std::error::Error and provide detailed context for debugging.

Variants§

§

ReqwestError(Error)

HTTP client error from the underlying reqwest library.

Occurs when network requests fail, timeouts occur, or connection issues arise.

§

UrlError(ParseError)

URL parsing error when constructing request URLs.

Occurs when the base URL or path parameters create an invalid URL.

§

HeadersError(Error)

HTTP header processing error.

Occurs when header values cannot be processed or are malformed.

§

HttpError(Error)

HTTP protocol error from the http crate.

Occurs when HTTP protocol constraints are violated.

§

InvalidHeaderName(InvalidHeaderName)

Invalid HTTP header name.

Occurs when attempting to create headers with invalid names.

§

InvalidHeaderValue(InvalidHeaderValue)

Invalid HTTP header value.

Occurs when header values contain invalid characters.

§

JsonValueError(Error)

JSON serialization/deserialization error.

Occurs when working with JSON request bodies or responses.

§

QuerySerializationError(Error)

Query parameter serialization error.

Occurs when converting structures to URL query strings.

§

AuthenticationError(AuthenticationError)

Authentication processing error.

Occurs when authentication credentials cannot be processed or are invalid.

§

CallResultRequired

No call result available for operation.

Occurs when attempting to access response data before making a request.

§

InvalidBasePath

Invalid base path configuration.

Occurs when the provided base path cannot be used for URL construction.

Fields

§error: String

Description of why the base path is invalid.

§

JsonError

JSON response deserialization failure.

Occurs when the response body cannot be parsed as the expected JSON structure.

Fields

§path: String

The request path where the error occurred.

§error: Error

The underlying JSON parsing error.

§body: String

The response body that failed to parse.

§

UnsupportedJsonOutput

Response output type is incompatible with JSON deserialization.

Occurs when attempting to parse non-JSON responses as JSON.

Fields

§output: Output

The actual response output received.

§name: &'static str

Name of the operation that failed.

§

UnsupportedTextOutput

Response output type is incompatible with text extraction.

Occurs when attempting to extract text from binary or empty responses.

Fields

§output: Output

The actual response output received.

§

UnsupportedBytesOutput

Response output type is incompatible with byte extraction.

Occurs when attempting to extract bytes from empty responses.

Fields

§output: Output

The actual response output received.

§

PathUnresolved

Path template contains unresolved parameters.

Occurs when path parameters are missing for templated URLs.

Fields

§path: String

The path template that couldn’t be resolved.

§missings: Vec<String>

List of missing parameter names.

§

UnsupportedQueryParameterValue

Query parameter value type is not supported.

Occurs when attempting to use complex objects as query parameters.

Fields

§value: Value

The unsupported value that was provided.

§

UnsupportedParameterValue

Parameter value cannot be converted to the required format.

Occurs when parameter values are incompatible with their target type.

Fields

§message: String

Specific error message describing the conversion failure.

§value: Value

The value that failed to convert.

§

MissingOperation

OpenAPI operation not found in the specification.

Occurs when referencing operations that don’t exist in the collected spec.

Fields

§id: String

The operation ID that was not found.

§

ServerFailure

Server returned an internal error (HTTP 500).

Occurs when the server encounters an internal error during request processing.

Fields

§raw_body: String

The response body containing error details.

§

SerializationError

Data serialization failed.

Occurs when request data cannot be converted to the required format.

Fields

§message: String

Description of the serialization failure.

§

UnexpectedStatusCode

Server returned an unexpected HTTP status code.

Occurs when the response status code doesn’t match expected values.

Fields

§status_code: u16

The unexpected HTTP status code received.

§body: String

The response body for debugging.

Trait Implementations§

Source§

impl Debug for ApiClientError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ApiClientError

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ApiClientError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ApiClientError> for TestAppError

Source§

fn from(value: ApiClientError) -> Self

Converts to this type from the input type.
Source§

impl From<AuthenticationError> for ApiClientError

Source§

fn from(value: AuthenticationError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ApiClientError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ApiClientError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ApiClientError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ApiClientError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ApiClientError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidHeaderName> for ApiClientError

Source§

fn from(value: InvalidHeaderName) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidHeaderValue> for ApiClientError

Source§

fn from(value: InvalidHeaderValue) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for ApiClientError

Source§

fn from(value: ParseError) -> Self

Converts to this type from the input type.
Source§

impl From<String> for ApiClientError

Source§

fn from(value: String) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,