From b64b7e739d56ae8cb8bb1f5f9204a4c4d810977b Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 31 Aug 2022 21:44:10 +0200 Subject: refactor: improve async DI container cast errors --- src/errors/async_di_container.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/errors') diff --git a/src/errors/async_di_container.rs b/src/errors/async_di_container.rs index bdb6fa0..22d8fdd 100644 --- a/src/errors/async_di_container.rs +++ b/src/errors/async_di_container.rs @@ -15,8 +15,17 @@ use crate::errors::injectable::InjectableError; pub enum AsyncDIContainerError { /// Unable to cast a binding for a interface. - #[error("Unable to cast binding for interface '{0}'")] - CastFailed(&'static str), + #[error( + "Unable to cast binding for interface '{interface} with kind '{binding_kind}'" + )] + CastFailed + { + /// The interface. + interface: &'static str, + + /// The kind of the found binding. + binding_kind: &'static str, + }, /// Failed to resolve a binding for a interface. #[error("Failed to resolve binding for interface '{interface}'")] -- cgit v1.2.3-18-g5258