diff options
author | HampusM <hampus@hampusmat.com> | 2022-11-06 14:06:22 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-11-06 14:06:22 +0100 |
commit | 3c993aa73c93f0fe335ced78d9709b39cdbd1935 (patch) | |
tree | 5b8d1d3bf743fe2383687d172caaee08df69a08b /src/di_container/asynchronous/mod.rs | |
parent | e665c2a3ca9b15f406c8e12e4a7ab372fcad4d36 (diff) |
refactor: improve cast error handling
Diffstat (limited to 'src/di_container/asynchronous/mod.rs')
-rw-r--r-- | src/di_container/asynchronous/mod.rs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/di_container/asynchronous/mod.rs b/src/di_container/asynchronous/mod.rs index 7dda1d7..89b2fba 100644 --- a/src/di_container/asynchronous/mod.rs +++ b/src/di_container/asynchronous/mod.rs @@ -270,7 +270,12 @@ impl AsyncDIContainer >( )) } - CastError::CastFailed { from: _, to: _ } => { + CastError::CastFailed { + source: _, + from: _, + to: _, + } + | CastError::GetCasterFailed(_) => { AsyncDIContainerError::CastFailed { interface: type_name::<Interface>(), binding_kind: "singleton", @@ -291,7 +296,12 @@ impl AsyncDIContainer type_name::<Interface>(), ) } - CastError::CastFailed { from: _, to: _ } => { + CastError::CastFailed { + source: _, + from: _, + to: _, + } + | CastError::GetCasterFailed(_) => { AsyncDIContainerError::CastFailed { interface: type_name::<Interface>(), binding_kind: "factory", @@ -348,12 +358,15 @@ impl AsyncDIContainer CastError::NotArcCastable(_) => { AsyncDIContainerError::InterfaceNotAsync(type_name::<Type>()) } - CastError::CastFailed { from: _, to: _ } => { - AsyncDIContainerError::CastFailed { - interface: type_name::<Type>(), - binding_kind, - } + CastError::CastFailed { + source: _, + from: _, + to: _, } + | CastError::GetCasterFailed(_) => AsyncDIContainerError::CastFailed { + interface: type_name::<Type>(), + binding_kind, + }, }) } |