aboutsummaryrefslogtreecommitdiff
path: root/src/di_container_binding_map.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-21 14:19:07 +0200
committerHampusM <hampus@hampusmat.com>2022-08-21 18:17:51 +0200
commit8c66b98bca6ed0a2990903fe8e0ea72def5c7be8 (patch)
treedeed78171051262dba7e8d97eba73a9aaf04dd5e /src/di_container_binding_map.rs
parentb3e1b993b028bbfa73638236cfbdb50ee478d3f0 (diff)
refactor!: change errors to be more sane
BREAKING CHANGE: Major improvements have been made to error types and the error_stack crate is no longer used
Diffstat (limited to 'src/di_container_binding_map.rs')
-rw-r--r--src/di_container_binding_map.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/di_container_binding_map.rs b/src/di_container_binding_map.rs
index fee33b0..e64ff17 100644
--- a/src/di_container_binding_map.rs
+++ b/src/di_container_binding_map.rs
@@ -1,7 +1,6 @@
use std::any::{type_name, TypeId};
use ahash::AHashMap;
-use error_stack::report;
use crate::{errors::di_container::DIContainerError, provider::IProvider};
@@ -19,7 +18,7 @@ impl DIContainerBindingMap
}
}
- pub fn get<Interface>(&self) -> error_stack::Result<&dyn IProvider, DIContainerError>
+ pub fn get<Interface>(&self) -> Result<&dyn IProvider, DIContainerError>
where
Interface: 'static + ?Sized,
{
@@ -28,12 +27,7 @@ impl DIContainerBindingMap
Ok(self
.bindings
.get(&interface_typeid)
- .ok_or_else(|| {
- report!(DIContainerError).attach_printable(format!(
- "No binding exists for interface '{}'",
- type_name::<Interface>()
- ))
- })?
+ .ok_or_else(|| DIContainerError::BindingNotFound(type_name::<Interface>()))?
.as_ref())
}