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
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());