pub enum CommandError {
Show 16 variants
Create(Box<CreateCommandError>),
Destroy(Box<DestroySubcommandError>),
Docs(Box<DocsCommandError>),
Provision(Box<ProvisionSubcommandError>),
Configure(Box<ConfigureSubcommandError>),
Test(Box<TestSubcommandError>),
Register(Box<RegisterSubcommandError>),
Release(Box<ReleaseSubcommandError>),
Render(Box<RenderCommandError>),
Run(Box<RunSubcommandError>),
Show(Box<ShowSubcommandError>),
Exists(Box<ExistsSubcommandError>),
List(Box<ListSubcommandError>),
Purge(Box<PurgeSubcommandError>),
Validate(Box<ValidateSubcommandError>),
UserOutputLockFailed,
}Expand description
Errors that can occur during CLI command execution
This enum provides a unified interface for all command-specific errors, following the project’s error handling conventions with structured error types, source preservation, and tiered help system support.
Variants§
Create(Box<CreateCommandError>)
Create command specific errors
Encapsulates all errors that can occur during create operations (environment or template).
Use .help() for detailed troubleshooting steps.
Destroy(Box<DestroySubcommandError>)
Destroy command specific errors
Encapsulates all errors that can occur during environment destruction.
Use .help() for detailed troubleshooting steps.
Docs(Box<DocsCommandError>)
Docs command specific errors
Encapsulates all errors that can occur during CLI documentation generation.
Use .help() for detailed troubleshooting steps.
Provision(Box<ProvisionSubcommandError>)
Provision command specific errors
Encapsulates all errors that can occur during infrastructure provisioning.
Use .help() for detailed troubleshooting steps.
Configure(Box<ConfigureSubcommandError>)
Configure command specific errors
Encapsulates all errors that can occur during environment configuration.
Use .help() for detailed troubleshooting steps.
Test(Box<TestSubcommandError>)
Test command specific errors
Encapsulates all errors that can occur during infrastructure validation.
Use .help() for detailed troubleshooting steps.
Register(Box<RegisterSubcommandError>)
Register command specific errors
Encapsulates all errors that can occur during instance registration.
Use .help() for detailed troubleshooting steps.
Release(Box<ReleaseSubcommandError>)
Release command specific errors
Encapsulates all errors that can occur during software release operations.
Use .help() for detailed troubleshooting steps.
Render(Box<RenderCommandError>)
Render command specific errors
Encapsulates all errors that can occur during artifact generation.
Use .help() for detailed troubleshooting steps.
Run(Box<RunSubcommandError>)
Run command specific errors
Encapsulates all errors that can occur during stack execution.
Use .help() for detailed troubleshooting steps.
Show(Box<ShowSubcommandError>)
Show command specific errors
Encapsulates all errors that can occur during environment information display.
Use .help() for detailed troubleshooting steps.
Exists(Box<ExistsSubcommandError>)
Exists command specific errors
Encapsulates all errors that can occur during environment existence check.
Use .help() for detailed troubleshooting steps.
List(Box<ListSubcommandError>)
List command specific errors
Encapsulates all errors that can occur during environment listing.
Use .help() for detailed troubleshooting steps.
Purge(Box<PurgeSubcommandError>)
Purge command specific errors
Encapsulates all errors that can occur during local environment data removal.
Use .help() for detailed troubleshooting steps.
Validate(Box<ValidateSubcommandError>)
Validate command specific errors
Encapsulates all errors that can occur during configuration validation.
Use .help() for detailed troubleshooting steps.
UserOutputLockFailed
User output lock acquisition failed
Failed to acquire the mutex lock for user output. This typically indicates a panic occurred in another thread while holding the lock.
Implementations§
Source§impl CommandError
impl CommandError
Sourcepub fn help(&self) -> String
pub fn help(&self) -> String
Get detailed troubleshooting guidance for this error
This method provides comprehensive troubleshooting steps that can be displayed to users when they need more help resolving the error. It delegates to the specific command error’s help method.
§Example
use clap::Parser;
use torrust_tracker_deployer_lib::presentation::cli::errors;
use torrust_tracker_deployer_lib::presentation::cli::controllers::destroy::DestroySubcommandError;
use torrust_tracker_deployer_lib::application::command_handlers::destroy::DestroyCommandHandlerError;
use std::path::PathBuf;
// Create error for demonstration
let destroy_error = DestroySubcommandError::DestroyOperationFailed {
name: "test-env".to_string(),
source: DestroyCommandHandlerError::StateCleanupFailed {
path: PathBuf::from("/tmp/test"),
source: std::io::Error::new(std::io::ErrorKind::PermissionDenied, "access denied"),
},
};
let error = errors::CommandError::Destroy(Box::new(destroy_error));
// Get help text
let help_text = error.help();
println!("{}", help_text);Trait Implementations§
Source§impl Debug for CommandError
impl Debug for CommandError
Source§impl Display for CommandError
impl Display for CommandError
Source§impl Error for CommandError
impl Error for CommandError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ConfigureSubcommandError> for CommandError
impl From<ConfigureSubcommandError> for CommandError
Source§fn from(error: ConfigureSubcommandError) -> Self
fn from(error: ConfigureSubcommandError) -> Self
Source§impl From<CreateCommandError> for CommandError
impl From<CreateCommandError> for CommandError
Source§fn from(error: CreateCommandError) -> Self
fn from(error: CreateCommandError) -> Self
Source§impl From<DestroySubcommandError> for CommandError
impl From<DestroySubcommandError> for CommandError
Source§fn from(error: DestroySubcommandError) -> Self
fn from(error: DestroySubcommandError) -> Self
Source§impl From<DocsCommandError> for CommandError
impl From<DocsCommandError> for CommandError
Source§fn from(error: DocsCommandError) -> Self
fn from(error: DocsCommandError) -> Self
Source§impl From<ExistsSubcommandError> for CommandError
impl From<ExistsSubcommandError> for CommandError
Source§fn from(error: ExistsSubcommandError) -> Self
fn from(error: ExistsSubcommandError) -> Self
Source§impl From<ListSubcommandError> for CommandError
impl From<ListSubcommandError> for CommandError
Source§fn from(error: ListSubcommandError) -> Self
fn from(error: ListSubcommandError) -> Self
Source§impl From<ProvisionSubcommandError> for CommandError
impl From<ProvisionSubcommandError> for CommandError
Source§fn from(error: ProvisionSubcommandError) -> Self
fn from(error: ProvisionSubcommandError) -> Self
Source§impl From<PurgeSubcommandError> for CommandError
impl From<PurgeSubcommandError> for CommandError
Source§fn from(error: PurgeSubcommandError) -> Self
fn from(error: PurgeSubcommandError) -> Self
Source§impl From<RegisterSubcommandError> for CommandError
impl From<RegisterSubcommandError> for CommandError
Source§fn from(error: RegisterSubcommandError) -> Self
fn from(error: RegisterSubcommandError) -> Self
Source§impl From<ReleaseSubcommandError> for CommandError
impl From<ReleaseSubcommandError> for CommandError
Source§fn from(error: ReleaseSubcommandError) -> Self
fn from(error: ReleaseSubcommandError) -> Self
Source§impl From<RenderCommandError> for CommandError
impl From<RenderCommandError> for CommandError
Source§fn from(error: RenderCommandError) -> Self
fn from(error: RenderCommandError) -> Self
Source§impl From<RunSubcommandError> for CommandError
impl From<RunSubcommandError> for CommandError
Source§fn from(error: RunSubcommandError) -> Self
fn from(error: RunSubcommandError) -> Self
Source§impl From<ShowSubcommandError> for CommandError
impl From<ShowSubcommandError> for CommandError
Source§fn from(error: ShowSubcommandError) -> Self
fn from(error: ShowSubcommandError) -> Self
Source§impl From<TestSubcommandError> for CommandError
impl From<TestSubcommandError> for CommandError
Source§fn from(error: TestSubcommandError) -> Self
fn from(error: TestSubcommandError) -> Self
Source§impl From<ValidateSubcommandError> for CommandError
impl From<ValidateSubcommandError> for CommandError
Source§fn from(error: ValidateSubcommandError) -> Self
fn from(error: ValidateSubcommandError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for CommandError
impl !UnwindSafe for CommandError
impl Freeze for CommandError
impl Send for CommandError
impl Sync for CommandError
impl Unpin for CommandError
impl UnsafeUnpin for CommandError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = !
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.