#[non_exhaustive]pub enum Error {
Show 26 variants
EmptyGroup {
type_name: &'static str,
},
GroupMemberTypeMismatch {
expected: &'static str,
actual: &'static str,
},
AlreadyProvided(&'static str),
AlreadyProvidedPrivate {
module: &'static str,
type_name: &'static str,
},
Cycle(String),
NotConstructed(&'static str),
MissingProvider {
type_name: &'static str,
module: &'static str,
},
ProviderMissingDep {
provider: &'static str,
module: &'static str,
dependency: &'static str,
},
InvokerMissingDep {
module: &'static str,
dependency: &'static str,
},
Downcast(&'static str),
ConstructorFailed {
type_name: &'static str,
source: BoxError,
},
InvokerFailed {
name: &'static str,
source: BoxError,
},
AppendAfterStart,
AppendWhileStopping,
BuildTimeout(Duration),
StartTimeout(Duration),
StopTimeout(Duration),
UnwindTimeout(Duration),
TaskFailedDuringStart,
SigintListen(Error),
SigtermListen(Error),
SignalListen(Error),
MultipleStop(MultipleStopError),
CleanupAfterFailure {
cleanup: Box<Error>,
earlier: Box<Error>,
},
Hook {
name: &'static str,
source: BoxError,
},
Io {
context: String,
source: Error,
},
}Expand description
Errors produced while wiring, starting, or stopping an application.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EmptyGroup
A required group has no members.
GroupMemberTypeMismatch
A group member provider’s result type does not match the declared element type.
Fields
AlreadyProvided(&'static str)
A public type was registered more than once.
AlreadyProvidedPrivate
A private type was registered more than once in the same module.
Fields
Cycle(String)
The dependency graph contains a cycle.
NotConstructed(&'static str)
A value was requested before it had been constructed.
MissingProvider
No provider exists for a requested type.
ProviderMissingDep
A provider depends on something nothing registers.
Fields
InvokerMissingDep
An invoker depends on something nothing registers.
Fields
Downcast(&'static str)
Internal downcast of a cached value failed.
ConstructorFailed
A fallible constructor returned an error.
Fields
InvokerFailed
A fallible invoker returned an error.
Fields
AppendAfterStart
Hook registration after start completed.
AppendWhileStopping
Hook registration while stopping.
BuildTimeout(Duration)
Graph construction exceeded its budget.
StartTimeout(Duration)
Start phase exceeded its budget.
StopTimeout(Duration)
Stop phase exceeded its budget.
UnwindTimeout(Duration)
Unwind after a failed/cancelled start exceeded its budget.
TaskFailedDuringStart
A background crate::task failed while start was still running, and
unwind did not surface a more specific join error.
SigintListen(Error)
Failed to install a SIGINT listener.
SigtermListen(Error)
Failed to install a SIGTERM listener.
SignalListen(Error)
Failed to install a process-signal listener (non-Unix platforms).
MultipleStop(MultipleStopError)
Several OnStop hooks failed; see MultipleStopError::errors.
CleanupAfterFailure
Cleanup failed after an earlier phase error; both are retained.
Hook
An application hook returned this failure.
Prefer Error::hook rather than constructing this variant directly.
crate::Lifecycle overwrites Self::Hook::name with the registering
hook’s Hook::name when start/stop returns this
variant. Error::Io and other variants are left unchanged.
Fields
name: &'static strcrate::Hook::name; defaults to "unnamed" from Error::hook
until crate::Lifecycle attaches the registering hook’s name.
Io
I/O failure with a short context label (e.g. bind / serve).
Prefer Error::io rather than constructing this variant directly.
Implementations§
Source§impl Error
impl Error
Sourcepub fn hook(err: impl Into<BoxError>) -> Self
pub fn hook(err: impl Into<BoxError>) -> Self
Wrap a hook failure, keeping the original error as std::error::Error::source.
Accepts anything convertible to BoxError, including &str, String,
std::io::Error, and types that implement std::error::Error.
crate::Lifecycle overwrites Self::Hook::name with the registering
hook’s Hook::name when start/stop returns this variant.
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()