pub enum CliError {
Show 22 variants
InvalidArgument {
arg: String,
value: String,
reason: String,
hint: Option<String>,
},
MissingArgument {
arg: String,
context: String,
},
ConflictingArguments {
arg1: String,
arg2: String,
reason: String,
},
InvalidArgumentCombination {
args: Vec<String>,
reason: String,
},
ConfigIo {
path: PathBuf,
message: String,
},
ConfigParse {
path: PathBuf,
message: String,
line: Option<usize>,
},
ConfigValue {
path: PathBuf,
key: String,
value: String,
reason: String,
},
RomLoad {
path: PathBuf,
message: String,
},
RomNotFound {
path: PathBuf,
},
RomInvalid {
path: PathBuf,
reason: String,
},
SavestateLoad {
source: String,
message: String,
},
SavestateSave {
destination: String,
message: String,
},
SavestateInvalid {
source: String,
reason: String,
},
InvalidAddress {
address: String,
reason: String,
},
InvalidMemoryRange {
range: String,
reason: String,
hint: Option<String>,
},
MemoryAccess {
operation: String,
address: u16,
message: String,
},
Execution {
message: String,
cycles: Option<u128>,
frames: Option<u64>,
},
InvalidStopCondition {
condition: String,
reason: String,
hint: Option<String>,
},
OutputWrite {
destination: String,
message: String,
},
InvalidOutputFormat {
format: String,
valid_formats: Vec<String>,
},
Io {
operation: String,
message: String,
},
Internal {
message: String,
},
}Expand description
Comprehensive error type for CLI operations.
This enum covers all possible error conditions in the CLI module, providing structured information for error handling and reporting.
Variants§
InvalidArgument
Invalid argument value
MissingArgument
Missing required argument
ConflictingArguments
Conflicting arguments specified
InvalidArgumentCombination
Invalid combination of arguments
ConfigIo
Failed to read config file
ConfigParse
Failed to parse config file
ConfigValue
Invalid config value
RomLoad
Failed to load ROM
RomNotFound
ROM not found
RomInvalid
Invalid ROM format
SavestateLoad
Failed to load savestate
SavestateSave
Failed to save savestate
SavestateInvalid
Invalid savestate format
InvalidAddress
Invalid memory address
InvalidMemoryRange
Invalid memory range
MemoryAccess
Memory access error
Execution
Execution error
InvalidStopCondition
Invalid stop condition
OutputWrite
Failed to write output
InvalidOutputFormat
Invalid output format
Io
I/O error
Internal
Internal error (should not happen)
Implementations§
Source§impl CliError
impl CliError
Sourcepub fn invalid_arg(
arg: impl Into<String>,
value: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_arg( arg: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid argument error.
Sourcepub fn invalid_arg_with_hint(
arg: impl Into<String>,
value: impl Into<String>,
reason: impl Into<String>,
hint: impl Into<String>,
) -> Self
pub fn invalid_arg_with_hint( arg: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, hint: impl Into<String>, ) -> Self
Create an invalid argument error with a hint.
Sourcepub fn missing_arg(arg: impl Into<String>, context: impl Into<String>) -> Self
pub fn missing_arg(arg: impl Into<String>, context: impl Into<String>) -> Self
Create a missing argument error.
Sourcepub fn conflicting_args(
arg1: impl Into<String>,
arg2: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn conflicting_args( arg1: impl Into<String>, arg2: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a conflicting arguments error.
Sourcepub fn config_io(path: impl Into<PathBuf>, err: impl Display) -> Self
pub fn config_io(path: impl Into<PathBuf>, err: impl Display) -> Self
Create a config I/O error.
Sourcepub fn config_parse(path: impl Into<PathBuf>, err: impl Display) -> Self
pub fn config_parse(path: impl Into<PathBuf>, err: impl Display) -> Self
Create a config parse error.
Sourcepub fn invalid_memory_range(
range: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_memory_range( range: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid memory range error.
Sourcepub fn invalid_address(
address: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_address( address: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid address error.
Sourcepub fn savestate_load(source: impl Into<String>, err: impl Display) -> Self
pub fn savestate_load(source: impl Into<String>, err: impl Display) -> Self
Create a savestate load error.
Sourcepub fn savestate_save(destination: impl Into<String>, err: impl Display) -> Self
pub fn savestate_save(destination: impl Into<String>, err: impl Display) -> Self
Create a savestate save error.
Sourcepub fn invalid_stop_condition(
condition: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn invalid_stop_condition( condition: impl Into<String>, reason: impl Into<String>, ) -> Self
Create an invalid stop condition error.
Sourcepub fn output_write(destination: impl Into<String>, err: impl Display) -> Self
pub fn output_write(destination: impl Into<String>, err: impl Display) -> Self
Create an output write error.
Sourcepub fn is_user_error(&self) -> bool
pub fn is_user_error(&self) -> bool
Check if this is a user error (invalid input).
Sourcepub fn is_io_error(&self) -> bool
pub fn is_io_error(&self) -> bool
Check if this is an I/O error.
Trait Implementations§
Source§impl Error for CliError
impl Error for CliError
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
Auto Trait Implementations§
impl Freeze for CliError
impl RefUnwindSafe for CliError
impl Send for CliError
impl Sync for CliError
impl Unpin for CliError
impl UnsafeUnpin for CliError
impl UnwindSafe for CliError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more