aboutsummaryrefslogtreecommitdiff
path: root/src/errors/injectable.rs
blob: 4b9af9618328de85eb299e189e6fa7527e1fb488 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![allow(clippy::module_name_repetitions)]
//! Error types for structs that implement [`Injectable`].
//!
//! [`Injectable`]: crate::interfaces::injectable::Injectable

use super::di_container::DIContainerError;

/// Error type for structs that implement [`Injectable`].
///
/// [`Injectable`]: crate::interfaces::injectable::Injectable
#[derive(thiserror::Error, Debug)]
pub enum InjectableError
{
    /// Failed to resolve dependencies.
    #[error("Failed to resolve a dependency of '{affected}'")]
    ResolveFailed
    {
        /// The reason for the problem.
        #[source]
        reason: Box<DIContainerError>,

        /// The affected injectable type.
        affected: &'static str,
    },

    /// Detected circular dependencies.
    #[error("Detected circular dependencies. {dependency_trace}")]
    DetectedCircular
    {
        /// A visual trace of dependencies.
        dependency_trace: String,
    },
}