From 8c66b98bca6ed0a2990903fe8e0ea72def5c7be8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 21 Aug 2022 14:19:07 +0200 Subject: 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 --- src/di_container_binding_map.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/di_container_binding_map.rs') 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(&self) -> error_stack::Result<&dyn IProvider, DIContainerError> + pub fn get(&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::() - )) - })? + .ok_or_else(|| DIContainerError::BindingNotFound(type_name::()))? .as_ref()) } -- cgit v1.2.3-18-g5258