docker-client-async 0.1.0

A modern async/await Docker client written in Rust.
Documentation
/*
 * Copyright 2020 Damian Peckett <damian@pecke.tt>.
 * Copyright 2013-2018 Docker, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//! Docker client errors.

use hyper::http;
use snafu::Snafu;

/// Docker client errors.
#[derive(Debug, Snafu)]
#[snafu(visibility = "pub(crate)")]
pub enum Error {
    /// Failed to decode a base64 encoded field.
    #[snafu(display("base64 decoding error: {}", source))]
    B64DecodingError { source: base64::DecodeError },

    /// Failed to parse a TLS certificate.
    #[snafu(display("certificate parse error: {}", source))]
    CertificateParseError { source: native_tls::Error },

    /// General TLS error.
    #[snafu(display("crypto error: {}", source))]
    CryptoError { source: openssl::error::ErrorStack },

    /// General HTTP client error.
    #[snafu(display("http client error: {}", source))]
    HttpClientError { source: hyper::Error },

    /// Failed to build HTTP client request.
    #[snafu(display("http client request builder error: {}", source))]
    HttpClientRequestBuilderError { source: http::Error },

    /// Bad response to HTTP request.
    #[snafu(display("http client response error: status = {}", status))]
    HttpClientResponseError { status: u16 },

    /// HTTP request timed out.
    #[snafu(display("http client timeout error: {}", source))]
    HttpClientTimeoutError { source: tokio::time::Elapsed },

    /// Invalid HTTP address.
    #[snafu(display("http uri error: {}", source))]
    HttpUriError { source: http::uri::InvalidUri },

    /// General IO errors.
    #[snafu(display("io error: {}", source))]
    IoError { source: std::io::Error },

    /// Failed to deserialize json response.
    #[snafu(display("json deserialization error: {}", source))]
    JsonDeserializationError { source: serde_json::Error },

    /// Failed to serialize json request.
    #[snafu(display("json serialization error: {}", source))]
    JsonSerializationError { source: serde_json::Error },

    /// Unexpected response from Docker api.
    #[snafu(display("malformed response"))]
    MalformedResponseError {},
}