Skip to main content

edgehog_device_runtime_containers/
error.rs

1// This file is part of Edgehog.
2//
3// Copyright 2023-2024 SECO Mind Srl
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9//    http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// SPDX-License-Identifier: Apache-2.0
18
19//! Error returned when interacting with the docker daemon
20
21use crate::{
22    container::ContainerError, image::ImageError, network::NetworkError, volume::VolumeError,
23};
24
25/// Error returned form the docker daemon
26#[non_exhaustive]
27#[derive(Debug, displaydoc::Display, thiserror::Error)]
28pub enum DockerError {
29    /// couldn't connect to the docker daemon docker
30    Connection(#[source] bollard::errors::Error),
31    /// couldn't negotiate a supported version with the daemon docker
32    Version(#[source] bollard::errors::Error),
33    /// couldn't listen to events
34    Events(#[source] bollard::errors::Error),
35    /// couldn't ping the docker daemon
36    Ping(#[source] bollard::errors::Error),
37    /// couldn't complete the image operation
38    Image(#[from] ImageError),
39    /// couldn't complete the volume operation
40    Volume(#[from] VolumeError),
41    /// couldn't complete the network operation
42    Network(#[from] NetworkError),
43    /// couldn't complete the container operation
44    Container(#[from] ContainerError),
45}