pub enum FliError {
Show 17 variants
CommandMismatch {
expected: String,
actual: String,
},
UnknownCommand(String, Vec<String>),
UnknownOption(String),
MissingValue {
option: String,
},
UnexpectedValue {
option: String,
value: String,
},
ValueCountMismatch {
option: String,
expected: usize,
actual: usize,
},
InvalidValue {
option: String,
value: String,
reason: String,
},
ValueParseError {
value: String,
expected_type: String,
reason: String,
},
InvalidStateTransition {
from: String,
to: String,
},
UnexpectedToken {
token: String,
position: usize,
},
InvalidOptionConfig {
option: String,
reason: String,
},
InvalidCommandConfig(String),
InvalidFlagFormat {
flag: String,
},
OptionNotFound(String),
ParserNotPrepared,
Internal(String),
InvalidUsage(String),
}Expand description
Errors that can occur during CLI parsing and execution
Variants§
CommandMismatch
Command name doesn’t match expected command
UnknownCommand(String, Vec<String>)
Unknown subcommand was specified
UnknownOption(String)
Unknown option flag was provided
MissingValue
Required option value is missing
UnexpectedValue
Option expects no value but one was provided
ValueCountMismatch
Wrong number of values provided
InvalidValue
Value parsing failed (e.g., string to int)
ValueParseError
Value type parsing failed
InvalidStateTransition
Invalid state transition during parsing
UnexpectedToken
Unexpected token at position
InvalidOptionConfig
Option configuration is invalid
InvalidCommandConfig(String)
Command configuration is invalid
InvalidFlagFormat
Option flag format is invalid
OptionNotFound(String)
Option was not found in parser
ParserNotPrepared
Parser not prepared before use
Internal(String)
Internal error (shouldn’t happen in normal usage)
InvalidUsage(String)
Invalid command usage (e.g., wrong flags or operands)
Implementations§
Source§impl FliError
impl FliError
Sourcepub fn command_mismatch(
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn command_mismatch( expected: impl Into<String>, actual: impl Into<String>, ) -> Self
Creates a command mismatch error
Sourcepub fn missing_value(option: impl Into<String>) -> Self
pub fn missing_value(option: impl Into<String>) -> Self
Creates a missing value error
Trait Implementations§
Source§impl Error for FliError
impl Error for FliError
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()