1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/// Enum to represent errors related to operations with the `AptosContainer`.
#[derive(thiserror::Error, Debug)]
pub enum AptosContainerError {
    /// Represents an IO error, wrapping a standard `std::io::Error`.
    #[error("io error {0}")]
    IOError(#[from] std::io::Error),

    /// Indicates that the file size is too large, providing the file path and its size in MB.
    #[error("file {path}:{size}MB is too big (max: 1MB)")]
    FileSizeTooBig {
        /// The path of the file that is too large.
        path: String,
        /// The size of the file in megabytes.
        size: f64,
    },

    /// Represents an error where a Docker exec command failed, providing the returned code.
    #[error("docker exec failed with returned code: {0}")]
    DockerExecFailed(i64),

    /// Indicates that a command failed to execute, providing the command and the associated stderr output.
    #[error("run command {command} failed: {stderr}")]
    CommandFailed {
        /// The command that was executed and failed.
        command: String,
        /// The standard error output from the command execution.
        stderr: String,
    },
}