Enum rocket::config::ConfigError

source ·
pub enum ConfigError {
    NotFound,
    IoError,
    Io(Error, &'static str),
    BadFilePath(PathBuf, &'static str),
    BadEnv(String),
    BadEntry(String, PathBuf),
    BadType(String, &'static str, &'static str, Option<PathBuf>),
    ParseError(String, PathBuf, String, Option<(usize, usize)>),
    BadEnvVal(String, String, String),
    UnknownKey(String),
    Missing(String),
}
Expand description

The type of a configuration error.

Variants§

§

NotFound

The configuration file was not found.

§

IoError

There was an I/O error while reading the configuration file.

§

Io(Error, &'static str)

There was an I/O error while setting a configuration parameter.

Parameters: (io_error, config_param_name)

§

BadFilePath(PathBuf, &'static str)

The path at which the configuration file was found was invalid.

Parameters: (path, reason)

§

BadEnv(String)

An environment specified in ROCKET_ENV is invalid.

Parameters: (environment_name)

§

BadEntry(String, PathBuf)

An environment specified as a table [environment] is invalid.

Parameters: (environment_name, filename)

§

BadType(String, &'static str, &'static str, Option<PathBuf>)

A config key was specified with a value of the wrong type.

Parameters: (entry_name, expected_type, actual_type, filename)

§

ParseError(String, PathBuf, String, Option<(usize, usize)>)

There was a TOML parsing error.

Parameters: (toml_source_string, filename, error_description, line/col)

§

BadEnvVal(String, String, String)

There was a TOML parsing error in a config environment variable.

Parameters: (env_key, env_value, error)

§

UnknownKey(String)

The entry (key) is unknown.

Parameters: (key)

§

Missing(String)

The entry (key) was expected but was missing.

Parameters: (key)

Implementations§

source§

impl ConfigError

source

pub fn pretty_print(&self)

Prints this configuration error with Rocket formatting.

source

pub fn is_not_found(&self) -> bool

Returns true if self is of NotFound variant.

§Example
use rocket::config::ConfigError;

let error = ConfigError::NotFound;
assert!(error.is_not_found());

Trait Implementations§

source§

impl Debug for ConfigError

source§

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

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

impl Display for ConfigError

source§

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

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

impl Error for ConfigError

source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
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 PartialEq for ConfigError

source§

fn eq(&self, other: &ConfigError) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

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, I> AsResult<T, I> for T
where I: Input,

source§

fn as_result(self) -> Result<T, ParseErr<I>>

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.

§

impl<T> IntoCollection<T> for T

§

fn into_collection<A>(self) -> SmallVec<A>
where A: Array<Item = T>,

Converts self into a collection.
§

fn mapped<U, F, A>(self, f: F) -> SmallVec<A>
where F: FnMut(T) -> U, A: Array<Item = U>,

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

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

§

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

§

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> Typeable for T
where T: Any,

source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V