...
This commit is contained in:
@@ -7,23 +7,35 @@ use std::fmt;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
|
||||
use super::text;
|
||||
use crate::text;
|
||||
|
||||
// Define a custom error type for run operations
|
||||
/// Error type for command and script execution operations
|
||||
///
|
||||
/// This enum represents various errors that can occur during command and script
|
||||
/// execution, including preparation, execution, and output handling.
|
||||
#[derive(Debug)]
|
||||
pub enum RunError {
|
||||
/// The command string was empty
|
||||
EmptyCommand,
|
||||
/// An error occurred while executing a command
|
||||
CommandExecutionFailed(io::Error),
|
||||
/// A command executed successfully but returned an error
|
||||
CommandFailed(String),
|
||||
/// An error occurred while preparing a script for execution
|
||||
ScriptPreparationFailed(String),
|
||||
/// An error occurred in a child process
|
||||
ChildProcessError(String),
|
||||
/// Failed to create a temporary directory
|
||||
TempDirCreationFailed(io::Error),
|
||||
/// Failed to create a script file
|
||||
FileCreationFailed(io::Error),
|
||||
/// Failed to write to a script file
|
||||
FileWriteFailed(io::Error),
|
||||
/// Failed to set file permissions
|
||||
PermissionError(io::Error),
|
||||
}
|
||||
|
||||
// Implement Display for RunError
|
||||
/// Implement Display for RunError to provide human-readable error messages
|
||||
impl fmt::Display for RunError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
|
Reference in New Issue
Block a user