Struct git_repository::config::key::Error
source · pub struct Error<E: Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> {
pub key: BString,
pub value: Option<BString>,
pub environment_override: Option<&'static str>,
pub source: Option<E>,
}
Expand description
A generic error suitable to produce decent messages for all kinds of configuration errors with config-key granularity.
This error is meant to be reusable and help produce uniform error messages related to parsing any configuration key.
Fields§
§key: BString
The configuration key that contained the value.
value: Option<BString>
The value that was assigned to key
.
environment_override: Option<&'static str>
The associated environment variable that would override this value.
source: Option<E>
The source of the error if there was one.
Implementations§
source§impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>where
E: Error + Send + Sync + 'static,
impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>where E: Error + Send + Sync + 'static,
Initialization
sourcepub fn from_value(key: &'static impl Key, value: BString) -> Self
pub fn from_value(key: &'static impl Key, value: BString) -> Self
Instantiate an error with all data from key
along with the value
of the key.
source§impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>where
E: Error + Send + Sync + 'static,
impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>where E: Error + Send + Sync + 'static,
Builder
sourcepub fn with_source(self, err: E) -> Self
pub fn with_source(self, err: E) -> Self
Attach the given err
as source.
sourcepub fn with_value(self, value: BString) -> Self
pub fn with_value(self, value: BString) -> Self
Attach the given value
as value we observed when the error was produced.
Trait Implementations§
source§impl<E: Debug + Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> Debug for Error<E, PREFIX, SUFFIX>
impl<E: Debug + Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> Debug for Error<E, PREFIX, SUFFIX>
source§impl<E: Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> Display for Error<E, PREFIX, SUFFIX>
impl<E: Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> Display for Error<E, PREFIX, SUFFIX>
source§impl<E, const PREFIX: char, const SUFFIX: char> Error for Error<E, PREFIX, SUFFIX>where
E: Error + 'static + Send + Sync,
Self: Debug + Display,
impl<E, const PREFIX: char, const SUFFIX: char> Error for Error<E, PREFIX, SUFFIX>where E: Error + 'static + Send + Sync, Self: Debug + Display,
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
source§impl<T, E, const PREFIX: char, const SUFFIX: char> From<&'static T> for Error<E, PREFIX, SUFFIX>where
E: Error + Send + Sync + 'static,
T: Key,
impl<T, E, const PREFIX: char, const SUFFIX: char> From<&'static T> for Error<E, PREFIX, SUFFIX>where E: Error + Send + Sync + 'static, T: Key,
Initialization
Instantiate a new error from the given key
.
Note that specifics of the error message are defined by the PREFIX
and SUFFIX
which is usually defined by a typedef.
source§fn from(key: &'static T) -> Self
fn from(key: &'static T) -> Self
source§impl From<Error<Error, 'k', 'i'>> for Error
impl From<Error<Error, 'k', 'i'>> for Error
source§fn from(source: GenericError) -> Self
fn from(source: GenericError) -> Self
source§impl From<Error<Error, 'k', 'i'>> for Error
Available on crate features async-network-client
or blocking-network-client
only.
impl From<Error<Error, 'k', 'i'>> for Error
async-network-client
or blocking-network-client
only.source§fn from(source: GenericError) -> Self
fn from(source: GenericError) -> Self
source§impl From<Error<Error, 'k', 'u'>> for Error
Available on crate features async-network-client
or blocking-network-client
only.
impl From<Error<Error, 'k', 'u'>> for Error
async-network-client
or blocking-network-client
only.source§impl From<Error<Error, 'v', 'i'>> for Error
impl From<Error<Error, 'v', 'i'>> for Error
source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
source§impl From<Error<Error, 'v', 'i'>> for Error
impl From<Error<Error, 'v', 'i'>> for Error
source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
source§impl From<Error<Error, 'v', 'i'>> for Error
impl From<Error<Error, 'v', 'i'>> for Error
source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
source§impl From<Error<Error, 'v', 'i'>> for Error
impl From<Error<Error, 'v', 'i'>> for Error
source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
Auto Trait Implementations§
impl<E, const PREFIX: char, const SUFFIX: char> RefUnwindSafe for Error<E, PREFIX, SUFFIX>where E: RefUnwindSafe,
impl<E, const PREFIX: char, const SUFFIX: char> Send for Error<E, PREFIX, SUFFIX>
impl<E, const PREFIX: char, const SUFFIX: char> Sync for Error<E, PREFIX, SUFFIX>
impl<E, const PREFIX: char, const SUFFIX: char> Unpin for Error<E, PREFIX, SUFFIX>where E: Unpin,
impl<E, const PREFIX: char, const SUFFIX: char> UnwindSafe for Error<E, PREFIX, SUFFIX>where E: UnwindSafe,
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
]. Read more