use crate::errors::injectable::InjectableError;
#[derive(thiserror::Error, Debug)]
pub enum AsyncDIContainerError
{
#[error(
"Unable to cast binding for interface '{interface} with kind '{binding_kind}'"
)]
CastFailed
{
interface: &'static str,
binding_kind: &'static str,
},
#[error("Failed to resolve binding for interface '{interface}'")]
BindingResolveFailed
{
#[source]
reason: InjectableError,
interface: &'static str,
},
#[error(
"No binding exists for interface '{interface}' {}",
.name.map_or_else(String::new, |name| format!("with name '{}'", name))
)]
BindingNotFound
{
interface: &'static str,
name: Option<&'static str>,
},
#[error("Interface '{0}' has not been marked async")]
InterfaceNotAsync(&'static str),
}
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingBuilderError
{
#[error("Binding already exists for interface '{0}'")]
BindingAlreadyExists(&'static str),
}
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingScopeConfiguratorError
{
#[error("Resolving the given singleton failed")]
SingletonResolveFailed(#[from] InjectableError),
}
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingWhenConfiguratorError
{
#[error("A binding for interface '{0}' wasn't found'")]
BindingNotFound(&'static str),
}