pub enum Error {
NotFound {
loader: String,
resource: String,
item: String,
},
NoAccess {
loader: String,
resource: String,
source: Box<dyn StdError + Send + Sync>,
},
Timeout {
loader: String,
resource: String,
timeout_in_seconds: u64,
source: Box<dyn StdError + Send + Sync>,
},
InvalidOption {
loader: String,
key: String,
reason: String,
},
InvalidResource {
loader: String,
resource: String,
reason: String,
},
Duplicate {
loader: String,
resource: String,
name: String,
format_1: String,
format_2: String,
},
Load {
loader: String,
resource: String,
description: String,
source: Box<dyn StdError + Send + Sync>,
},
Other(Box<dyn StdError + Send + Sync>),
}Expand description
Errors a Load implementation can return.
Each variant carries a loader field (set to your Load::name) so messages identify the
source. See Load’s “Choosing an error” section for guidance on which to pick.
Variants§
NotFound
The requested resource or entry does not exist and was not configured to be ignored.
item names what was missing (e.g. `file "app.json"`).
NoAccess
Access was denied (e.g. filesystem permissions, HTTP 401/403). source carries the
underlying backend error.
Timeout
The operation exceeded its deadline. timeout_in_seconds is the limit that was hit;
source carries the underlying backend error.
Fields
InvalidOption
An option is unknown, or has the wrong type or value. key is the option name; reason
explains the problem (commonly built from OptionValue::type_name on a type mismatch).
InvalidResource
The resource string is empty or malformed for this loader (e.g. a required path is
missing). reason explains what was expected.
Duplicate
Two entries resolve to the same name with differing formats (format_1 vs format_2),
so the loader cannot pick one unambiguously.
Load
Catch-all backend failure that doesn’t fit the variants above. description completes the
phrase “could not {description}” (e.g. "read contents of file"); source carries the
underlying error.
Other(Box<dyn StdError + Send + Sync>)
Bridge for opaque errors via ?/From, when none of the structured variants apply.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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
use the Display impl or to_string()