process/
error.rs

1//! # Error
2//!
3//! Module dedicated to process errors. It contains an [`Error`] enum
4//! based on [`thiserror::Error`] and a type alias [`Result`].
5
6use std::string::FromUtf8Error;
7
8use thiserror::Error;
9
10/// The global `Result` alias of the library.
11pub type Result<T> = std::result::Result<T, Error>;
12
13/// The global `Error` enum of the library.
14#[derive(Debug, Error)]
15pub enum Error {
16    #[error("cannot get standard input")]
17    GetStdinError,
18    #[error("cannot get exit status code of command: {0}")]
19    GetExitStatusCodeNotAvailableError(String),
20    #[error("command {0} returned non-zero exit status code {1}: {2}")]
21    GetExitStatusCodeNonZeroError(String, i32, String),
22    #[error("cannot parse command output as string")]
23    ParseOutputAsUtf8StringError(#[source] FromUtf8Error),
24
25    #[error(transparent)]
26    IoError(#[from] std::io::Error),
27}