Struct miau::error::ConfigurationError[][src]

pub struct ConfigurationError { /* fields omitted */ }

Represents all errors that might occur at all stages of processing configuration.

Implementations

impl ConfigurationError[src]

pub fn inner(&self) -> &ErrorCode[src]

Returns reference to underlying error code. Returned object has all contextual information stripped off.

pub fn enrich_with_context<T: Display>(self, message: T) -> Self[src]

Enriches error context with arbitray message.

Used to put more contextual information in the error to facilitate debugging issues. One can put e.g. path to file that failed to open in error message this way.

Example

use miau::error::{ConfigurationError, ErrorCode};

let error: ConfigurationError = ErrorCode::NullValue.into();

let enriched_error = error
    .enrich_with_context("Detailed description of contextual information");

pub fn enrich_with_key(self, key: Key) -> Self[src]

Enriches error context with a key.

Used to put more contextual information in the error to facilitate debugging issues. One can put information about location in configuration tree in error with this function.

Example

use miau::error::{ConfigurationError, ErrorCode};
use miau::configuration::Key;

let error: ConfigurationError = ErrorCode::NullValue.into();

let enriched_error = error
    .enrich_with_key(Key::Map("key".to_string()));

pub fn enrich_with_keys(self, keys: &CompoundKey) -> Self[src]

Enriches error context with a complex path.

Used to put more contextual information in the error to facilitate debugging issues. One can put information about location in configuration tree in error with this function.

pub fn pretty_display(&self) -> PrettyConfigurationDisplay<'_>[src]

Returns an object that displays error in pretty way.

Example

use miau::error::{ConfigurationError, ErrorCode};
use miau::configuration::Key;

let error: ConfigurationError = ErrorCode::NullValue.into();

println!("Basic display : {}", error);
println!("Pretty display : {}", error.pretty_display());

Methods from Deref<Target = ErrorImpl>

pub fn get_code(&self) -> &ErrorCode[src]

Returns reference to underlying cause of the error.

pub fn get_path(&self) -> Option<&[Key]>[src]

Returns path in configuration at which error occured.

Returned value is a slice with configuration keys counting from root.

pub fn get_context(&self) -> Option<&[String]>[src]

Returns additional context attached to error.

This information can contain, for instance, name of the file that was not found.

Trait Implementations

impl Debug for ConfigurationError[src]

impl Deref for ConfigurationError[src]

type Target = ErrorImpl

The resulting type after dereferencing.

impl Display for ConfigurationError[src]

impl Error for ConfigurationError[src]

impl Error for ConfigurationError[src]

impl From<Error> for ConfigurationError[src]

impl From<ErrorCode> for ConfigurationError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.