axoprocess/error.rs
1//! Errors!
2
3use miette::Diagnostic;
4use thiserror::Error;
5
6/// Gotta love a newtyped Result
7pub type Result<T> = std::result::Result<T, AxoprocessError>;
8
9/// An error from executing a Command
10#[derive(Debug, Error, Diagnostic)]
11pub enum AxoprocessError {
12 /// The command fundamentally failed to execute (usually means it didn't exist)
13 #[error("failed to {summary}")]
14 Exec {
15 /// Summary of what the Command was trying to do
16 summary: String,
17 /// What failed
18 #[source]
19 cause: std::io::Error,
20 },
21 /// The command ran but signaled some kind of error condition
22 /// (assuming the exit code is used for that)
23 #[error("failed to {summary} (status: {status})")]
24 Status {
25 /// Summary of what the Command was trying to do
26 summary: String,
27 /// What status the Command returned
28 status: std::process::ExitStatus,
29 },
30}