From 2d1a6b2d432408d74eb57e0bda3f7434617e1070 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 20 Jul 2022 14:29:45 +0200 Subject: refactor: reorganize folder hierarchy --- src/errors/di_container.rs | 17 +++++++++++++++++ src/errors/injectable.rs | 17 +++++++++++++++++ src/errors/mod.rs | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 src/errors/di_container.rs create mode 100644 src/errors/injectable.rs create mode 100644 src/errors/mod.rs (limited to 'src/errors') diff --git a/src/errors/di_container.rs b/src/errors/di_container.rs new file mode 100644 index 0000000..f2b8add --- /dev/null +++ b/src/errors/di_container.rs @@ -0,0 +1,17 @@ +use std::fmt; +use std::fmt::{Display, Formatter}; + +use error_stack::Context; + +#[derive(Debug)] +pub struct DIContainerError; + +impl Display for DIContainerError +{ + fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result + { + fmt.write_str("A DI container error has occurred") + } +} + +impl Context for DIContainerError {} diff --git a/src/errors/injectable.rs b/src/errors/injectable.rs new file mode 100644 index 0000000..6b0cdc5 --- /dev/null +++ b/src/errors/injectable.rs @@ -0,0 +1,17 @@ +use core::fmt; +use std::fmt::{Display, Formatter}; + +use error_stack::Context; + +#[derive(Debug)] +pub struct ResolveError; + +impl Display for ResolveError +{ + fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result + { + fmt.write_str("Failed to resolve injectable struct") + } +} + +impl Context for ResolveError {} diff --git a/src/errors/mod.rs b/src/errors/mod.rs new file mode 100644 index 0000000..b0d50f0 --- /dev/null +++ b/src/errors/mod.rs @@ -0,0 +1,2 @@ +pub mod di_container; +pub mod injectable; -- cgit v1.2.3-18-g5258