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: BStringThe 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>
Initialization
impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>
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>
Builder
impl<E, const PREFIX: char, const SUFFIX: char> Error<E, PREFIX, SUFFIX>
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>
impl<E, const PREFIX: char, const SUFFIX: char> Error for Error<E, PREFIX, SUFFIX>
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>
Initialization
Instantiate a new error from the given key.
impl<T, E, const PREFIX: char, const SUFFIX: char> From<&'static T> for Error<E, PREFIX, SUFFIX>
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, 'b', 'i'>> for Error
Available on crate feature worktree-mutation only.
impl From<Error<Error, 'b', 'i'>> for Error
worktree-mutation only.Source§impl From<Error<Error, 'b', 'i'>> for Error
Available on crate features async-network-client or blocking-network-client only.
impl From<Error<Error, 'b', 'i'>> for Error
async-network-client or blocking-network-client only.Source§impl From<Error<Error, 'k', 'i'>> for Error
Available on crate feature blob-diff only.
impl From<Error<Error, 'k', 'i'>> for Error
blob-diff only.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, 't', 'i'>> for Error
Available on crate features async-network-client-async-std or blocking-network-client only.
impl From<Error<Error, 't', 'i'>> for Error
async-network-client-async-std or blocking-network-client only.Source§impl From<Error<Error, 'v', 'i'>> for Error
Available on crate features async-network-client-async-std or blocking-network-client only.
impl From<Error<Error, 'v', 'i'>> for Error
async-network-client-async-std or blocking-network-client only.Source§impl From<Error<Error, 'v', 'i'>> for Error
Available on crate feature merge only.
impl From<Error<Error, 'v', 'i'>> for Error
merge only.Source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
Source§impl From<Error<Error, 'v', 'i'>> for Error
Available on crate feature index only.
impl From<Error<Error, 'v', 'i'>> for Error
index only.Source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
Source§impl From<Error<Error, 'v', 'i'>> for Error
Available on crate feature attributes only.
impl From<Error<Error, 'v', 'i'>> for Error
attributes only.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
Available on crate features async-network-client or blocking-network-client only.
impl From<Error<Error, 'v', 'i'>> for Error
async-network-client or blocking-network-client only.Source§fn from(source: GenericErrorWithValue) -> Self
fn from(source: GenericErrorWithValue) -> Self
Source§impl From<Error<Error, 'v', 'i'>> for Error
Available on crate feature status only.
impl From<Error<Error, 'v', 'i'>> for Error
status only.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
Available on crate feature attributes only.
impl From<Error<Error, 'v', 'i'>> for Error
attributes only.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
Available on crate feature attributes only.
impl From<Error<Error, 'v', 'i'>> for Error
attributes only.