Skip to main content

ConfigError

Enum ConfigError 

Source
#[non_exhaustive]
pub enum ConfigError {
Show 18 variants BadConfigLine { location: String, line: usize, }, BadConfigLineInFile { file: String, line: usize, }, MissingValue { key: String, }, BadConfigVariable { key: String, file: String, line: usize, }, KeyNotSet { key: String, }, BadNumericValue { key: String, value: String, reason: BadNumericSource, }, BadNumericValueInFile { key: String, value: String, file: String, reason: BadNumericSource, }, BadConfigVariableAtLine { key: String, file: String, line: usize, }, UnableToParseFromCommandLine { key: String, }, RemoteUrlInHasconfigInclude, IncludeDepthExceeded { depth: usize, limit: usize, }, Other(String), ConfigFileLocked { path: String, }, MultipleValues { key: String, }, WorktreeConfigNotEnabled, SectionNotFound { section: String, }, MultilineCommentNotAllowed, InvalidUntrackedFilesMode { value: String, },
}
Expand description

Configuration parse and validation failures.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BadConfigLine

A line in a config file could not be parsed.

Fields

§location: String

Config source label or path where the error was detected.

§line: usize

One-based line number within that source.

§

BadConfigLineInFile

Same as Self::BadConfigLine with an explicit file path (Git file diagnostics).

Fields

§file: String

Path to the config file involved in the error.

§line: usize

One-based line number within that file.

§

MissingValue

A config key requires a value but none was given.

Fields

§key: String

Config key name that failed validation.

§

BadConfigVariable

fetch.negotiationalgorithm and similar keys with missing values.

Fields

§key: String

Config key name that failed validation.

§file: String

Path to the config file involved in the error.

§line: usize

One-based line number within the config source.

§

KeyNotSet

unset or a scoped read/write was requested for a key that is not set in that file.

Fields

§key: String

Config key that was not present.

§

BadNumericValue

Integer config value could not be parsed or is out of range.

Fields

§key: String

Config key name that failed validation.

§value: String

Raw config value that could not be parsed.

§reason: BadNumericSource

Why the value or operation was rejected.

§

BadNumericValueInFile

Same as Self::BadNumericValue with file context.

Fields

§key: String

Config key name that failed validation.

§value: String

Raw config value that could not be parsed.

§file: String

Path to the config file involved in the error.

§reason: BadNumericSource

Why the value or operation was rejected.

§

BadConfigVariableAtLine

diff.context (or similar) failed variable validation.

Fields

§key: String

Config key name that failed validation.

§file: String

Path to the config file involved in the error.

§line: usize

One-based line number within the config source.

§

UnableToParseFromCommandLine

Command-line config could not supply a parseable value for a key.

Fields

§key: String

Config key name that failed validation.

§

RemoteUrlInHasconfigInclude

includeIf.hasconfig:remote.*.url cannot pull remote URLs from included files.

§

IncludeDepthExceeded

[include] / [includeIf] nesting exceeded the Git-compatible depth limit.

Fields

§depth: usize

Current include nesting depth when the limit was hit.

§limit: usize

Maximum allowed include nesting depth.

§

Other(String)

Generic config error with free-form detail (legacy call sites).

§

ConfigFileLocked

The config file could not be written because a .lock file is already present.

Fields

§path: String

Path to the config file that could not be locked.

§

MultipleValues

A single-value operation was requested but the key has multiple values.

Fields

§key: String

Config key name that failed validation.

§

WorktreeConfigNotEnabled

Per-worktree config was requested but extensions.worktreeConfig is off.

§

SectionNotFound

remove-section or rename-section did not find the named section.

Fields

§section: String

Section header name (e.g. remote.origin).

§

MultilineCommentNotAllowed

Inline --comment text must not span lines.

§

InvalidUntrackedFilesMode

status.showUntrackedFiles must be no, normal, all, or a Git boolean synonym.

Fields

§value: String

Raw config value that could not be parsed.

Implementations§

Source§

impl ConfigError

Source

pub fn message_body(&self) -> String

Git stderr body for this error (without a fatal: prefix).

Trait Implementations§

Source§

impl Clone for ConfigError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConfigError

Source§

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

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

impl Display for ConfigError

Source§

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

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

impl Eq for ConfigError

Source§

impl Error for ConfigError

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
Source§

impl From<&str> for ConfigError

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigError> for Error

Source§

fn from(source: ConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<String> for ConfigError

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ConfigError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ConfigError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.