1mod builder;
2mod cmd;
3mod containers;
4#[cfg(test)]
5mod containers_test;
6mod content;
7mod images;
8
9use std::error::Error;
10use std::fmt;
11use std::io;
12
13#[derive(Debug)]
15pub enum BuildahError {
16 CommandExecutionFailed(io::Error),
18 CommandFailed(String),
20 JsonParseError(String),
22 ConversionError(String),
24 Other(String),
26}
27
28impl fmt::Display for BuildahError {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 BuildahError::CommandExecutionFailed(e) => {
32 write!(f, "Failed to execute buildah command: {}", e)
33 }
34 BuildahError::CommandFailed(e) => write!(f, "Buildah command failed: {}", e),
35 BuildahError::JsonParseError(e) => write!(f, "Failed to parse JSON: {}", e),
36 BuildahError::ConversionError(e) => write!(f, "Conversion error: {}", e),
37 BuildahError::Other(e) => write!(f, "{}", e),
38 }
39 }
40}
41
42impl Error for BuildahError {
43 fn source(&self) -> Option<&(dyn Error + 'static)> {
44 match self {
45 BuildahError::CommandExecutionFailed(e) => Some(e),
46 _ => None,
47 }
48 }
49}
50pub use builder::Builder;
52
53pub use cmd::*;
55#[deprecated(since = "0.2.0", note = "Use Builder::new() instead")]
56pub use containers::*;
57pub use content::ContentOperations;
58#[deprecated(since = "0.2.0", note = "Use Builder methods instead")]
59pub use images::*;