pub struct ConfigurationError { /* private fields */ }Expand description
Represents all errors that might occur at all stages of processing configuration.
Implementations§
Source§impl ConfigurationError
impl ConfigurationError
Sourcepub fn inner(&self) -> &ErrorCode
pub fn inner(&self) -> &ErrorCode
Returns reference to underlying error code. Returned object has all contextual information stripped off.
Sourcepub fn enrich_with_context<T: Display>(self, message: T) -> Self
pub fn enrich_with_context<T: Display>(self, message: T) -> Self
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");Sourcepub fn enrich_with_key(self, key: Key) -> Self
pub fn enrich_with_key(self, key: Key) -> Self
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()));Sourcepub fn enrich_with_keys(self, keys: &CompoundKey) -> Self
pub fn enrich_with_keys(self, keys: &CompoundKey) -> Self
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.
Sourcepub fn pretty_display(&self) -> PrettyConfigurationDisplay<'_>
pub fn pretty_display(&self) -> PrettyConfigurationDisplay<'_>
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>§
Sourcepub fn get_path(&self) -> Option<&[Key]>
pub fn get_path(&self) -> Option<&[Key]>
Returns path in configuration at which error occured.
Returned value is a slice with configuration keys counting from root.
Sourcepub fn get_context(&self) -> Option<&[String]>
pub fn get_context(&self) -> Option<&[String]>
Returns additional context attached to error.
This information can contain, for instance, name of the file that was not found.
Trait Implementations§
Source§impl Debug for ConfigurationError
impl Debug for ConfigurationError
Source§impl Deref for ConfigurationError
impl Deref for ConfigurationError
Source§impl Display for ConfigurationError
impl Display for ConfigurationError
Source§impl Error for ConfigurationError
impl Error for ConfigurationError
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 Error for ConfigurationError
impl Error for ConfigurationError
Source§fn custom<T>(msg: T) -> Selfwhere
T: Display,
fn custom<T>(msg: T) -> Selfwhere
T: Display,
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.