FliError

Enum FliError 

Source
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

Fields

§expected: String
§actual: String
§

UnknownCommand(String, Vec<String>)

Unknown subcommand was specified

§

UnknownOption(String)

Unknown option flag was provided

§

MissingValue

Required option value is missing

Fields

§option: String
§

UnexpectedValue

Option expects no value but one was provided

Fields

§option: String
§value: String
§

ValueCountMismatch

Wrong number of values provided

Fields

§option: String
§expected: usize
§actual: usize
§

InvalidValue

Value parsing failed (e.g., string to int)

Fields

§option: String
§value: String
§reason: String
§

ValueParseError

Value type parsing failed

Fields

§value: String
§expected_type: String
§reason: String
§

InvalidStateTransition

Invalid state transition during parsing

Fields

§from: String
§

UnexpectedToken

Unexpected token at position

Fields

§token: String
§position: usize
§

InvalidOptionConfig

Option configuration is invalid

Fields

§option: String
§reason: String
§

InvalidCommandConfig(String)

Command configuration is invalid

§

InvalidFlagFormat

Option flag format is invalid

Fields

§flag: String
§

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

Source

pub fn command_mismatch( expected: impl Into<String>, actual: impl Into<String>, ) -> Self

Creates a command mismatch error

Source

pub fn missing_value(option: impl Into<String>) -> Self

Creates a missing value error

Source

pub fn invalid_value( option: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, ) -> Self

Creates an invalid value error

Source

pub fn value_count_mismatch( option: impl Into<String>, expected: usize, actual: usize, ) -> Self

Creates a value count mismatch error

Trait Implementations§

Source§

impl Debug for FliError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FliError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for FliError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.