[go: up one dir, main page]

Struct 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,

Initialization

Source

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,

Builder

Source

pub fn with_source(self, err: E) -> Self

Attach the given err as source.

Source

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>

Source§

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

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

impl<E: Error + Send + Sync + 'static, const PREFIX: char, const SUFFIX: char> Display for Error<E, PREFIX, SUFFIX>

Source§

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

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

impl<E, const PREFIX: char, const SUFFIX: char> Error for Error<E, PREFIX, SUFFIX>
where E: Error + 'static + Error + Send + Sync, Self: Debug + Display,

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

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature worktree-mutation only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature dirwalk only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature index only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature tree-editor only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate features async-network-client or blocking-network-client only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature status only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature status only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature status only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature merge only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature merge only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature merge only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature index only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'b', 'i'>> for Error

Available on crate feature credentials only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'd', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'i', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'i'>> for Error

Available on crate feature blob-diff only.
Source§

fn from(source: GenericError) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'i'>> for Error

Available on crate features async-network-client or blocking-network-client only.
Source§

fn from(source: GenericError) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Available on crate feature blob-diff only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'k', 'u'>> for Error

Available on crate features async-network-client or blocking-network-client only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'n', 'd'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 't', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 't', 'i'>> for Error

Available on crate features async-network-client-async-std or blocking-network-client only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 't', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 't', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate features async-network-client-async-std or blocking-network-client only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature merge only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature index only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate features async-network-client or blocking-network-client only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature status only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Available on crate feature attributes only.
Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Error, 'v', 'i'>> for Error

Source§

fn from(source: GenericErrorWithValue) -> Self

Converts to this type from the input type.
Source§

impl From<Error<Infallible, 's', 'i'>> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<E, const PREFIX: char, const SUFFIX: char> Freeze for Error<E, PREFIX, SUFFIX>
where E: Freeze,

§

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§

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,