aboutsummaryrefslogtreecommitdiff
path: root/macros/src/injectable/implementation.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-01-31 21:44:05 +0100
committerHampusM <hampus@hampusmat.com>2023-01-31 21:44:05 +0100
commit118651055b7844e04aa5b89023c385e483de305f (patch)
tree7386bf48a10732d9cadc7d19ed3d05fc0efd7b93 /macros/src/injectable/implementation.rs
parente8a2475b2f07da14c45a429b2b52e75322d0efb5 (diff)
fix: remove unwrap from generated implementations of Injectable
Diffstat (limited to 'macros/src/injectable/implementation.rs')
-rw-r--r--macros/src/injectable/implementation.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/macros/src/injectable/implementation.rs b/macros/src/injectable/implementation.rs
index e81dd2d..30132bf 100644
--- a/macros/src/injectable/implementation.rs
+++ b/macros/src/injectable/implementation.rs
@@ -430,10 +430,16 @@ impl<Dep: IDependency> InjectableImpl<Dep>
};
Ok(quote! {
- #do_method_call.map_err(|err| #resolve_failed_error {
- reason: Box::new(err),
- affected: self_type_name
- })?.#to_ptr().unwrap()
+ #do_method_call
+ .map_err(|err| #resolve_failed_error {
+ reason: Box::new(err),
+ affected: self_type_name
+ })?
+ .#to_ptr()
+ .map_err(|err| InjectableError:: PrepareDependencyFailed {
+ reason: err,
+ dependency_name: #dep_interface_str
+ })?
})
}