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
sourceimpl ConfigError
impl ConfigError
sourcepub fn pretty_print(&self)
pub fn pretty_print(&self)
Prints this configuration error with Rocket formatting.
sourcepub fn is_not_found(&self) -> bool
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
sourceimpl Debug for ConfigError
impl Debug for ConfigError
sourceimpl Display for ConfigError
impl Display for ConfigError
sourceimpl Error for ConfigError
impl Error for ConfigError
sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourceimpl PartialEq<ConfigError> for ConfigError
impl PartialEq<ConfigError> for ConfigError
Auto Trait Implementations
impl !RefUnwindSafe for ConfigError
impl Send for ConfigError
impl Sync for ConfigError
impl Unpin for ConfigError
impl !UnwindSafe for ConfigError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
sourcefn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.