pub enum DecUseError {
    ApiNotFound {
        uri: String,
    },
    ApiNotImplemented {
        uri: String,
    },
    HttpClientError(Error),
    Internal(DecLibraryError),
    NotFound {
        message: String,
    },
    StreamLineRead(StreamLineReadError),
    Rejected {
        status: StatusCode,
        message: String,
    },
    UnexpectedResponseContentType {
        expected: String,
        actual: Option<String>,
    },
    UnparseableJsonResponse {
        status: StatusCode,
        text: String,
        parse_error: Error,
    },
    UnparseableUtf8Response {
        status: StatusCode,
        content_type: Option<String>,
        parse_error: FromUtf8Error,
    },
}
Expand description

An error during the use of a Docker Engine client.

Variants§

§

ApiNotFound

Fields

Received a 404 Not Found response for a list-based api.

Possible causes are:

  1. DockerEngineClient was misconfigured with an incorrect URL.
  2. URL is correct but the Docker Engine it points to is incompatible with this library
§

ApiNotImplemented

Fields

Server returned 501 Not Implemented, most likely

Possible causes are:

  1. DockerEngineClient was misconfigured with an incorrect URL.
  2. URL is correct but the Docker Engine it points to is incompatible with this library
§

HttpClientError(Error)

A communication failure occurred while sending an HTTP request or receiving its response.

§

Internal(DecLibraryError)

See docs for DecInternalError.

§

NotFound

Fields

§message: String

Error message returned by the Docker Engine

An item managed by the Docker Engine, and required by the request, was not found (does not exist in the Docker Engine).

For example, you requested to start a container, but that container does not exist.

§

StreamLineRead(StreamLineReadError)

A problem while reading or parsing a container log or console output stream.

§

Rejected

Fields

§status: StatusCode

HTTP status returned by the Docker Engine

§message: String

Error message returned by the Docker Engine

Docker Engine rejected the request. Any number of failure status codes can produce this outcome, including but not limited to:

  • 400 Bad Request
  • 409 Conflict
  • 500 Server Error

However, this will not be used for 404 Not Found responses.

§

UnexpectedResponseContentType

Fields

§expected: String
§actual: Option<String>

Received a response from the HTTP server with an unexpected or missing Content-Type.

§

UnparseableJsonResponse

Fields

§status: StatusCode

HTTP status returned by the Docker Engine or whatever HTTP server we were connected to

§text: String

Raw text from HTTP response body. May or may not be valid JSON

§parse_error: Error

Error that prevent conversion to the expected response data structure

A response was received, but could not be parsed.

The two most likely causes:

  1. The JSON was malformed (or not json at all)
  2. The JSON was well formed, but the structure did not match the client’s expectations

A reverse-proxy related failure can cause #1 above. Malformed JSON from the actual Docker Engine is highly unlikely.

This enum is a possible outcome for both HTTP success statuses and failure statuses.

§

UnparseableUtf8Response

Fields

§status: StatusCode

HTTP status returned by the Docker Engine or whatever HTTP server we were connected to

§content_type: Option<String>

HTTP Content-Type response header value returned by the Docker Engine or whatever HTTP server we were connected to

§parse_error: FromUtf8Error

Error that prevented converting the HTTP response body bytes into UTF-8 (the encoding of application/json).

A response was received, but could not be decoded as UTF-8.

The most likely cause is a reverse-proxy related failure, and the reverse proxy sending back a non-UTF-8 plain text error message. Malformed UTF-8 from the actual Docker Engine is highly unlikely.

This enum is a possible outcome for both HTTP success statuses and failure statuses.

Implementations§

source§

impl DecUseError

source

pub fn error_message(&self) -> String

source

pub fn from_not_utf8(other: DockerEngineResponseNotUtf8) -> Self

Trait Implementations§

source§

impl Debug for DecUseError

source§

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

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

impl Display for DecUseError

source§

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

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

impl From<DecLibraryError> for DecUseError

source§

fn from(other: DecLibraryError) -> Self

Converts to this type from the input type.
source§

impl From<DecUseError> for DecError

source§

fn from(other: DecUseError) -> Self

Converts to this type from the input type.
source§

impl From<ParseError> for DecUseError

source§

fn from(other: ParseError) -> Self

Converts to this type from the input type.
source§

impl From<StreamLineReadError> for DecUseError

source§

fn from(other: StreamLineReadError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

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 Twhere U: TryFrom<T>,

§

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