Skip to main content

rex_logger/
errors.rs

1use anyhow::Error as AnyhowError;
2use std::error::Error as SourceError;
3use thiserror::Error;
4
5/// Represents errors that can occur during Rex logger operations.
6///
7/// This enum provides specific error variants for different types of failures that can occur
8/// during logging operations
9///
10/// # Variants
11///
12/// * `InitializationError` - Error during logger initialization
13/// * `Other` - `Anyhow` for other errors
14#[non_exhaustive]
15#[derive(Error, Debug)]
16pub enum RexLoggerError {
17    /// Error indicating an initialization error
18    ///
19    /// # Fields
20    ///
21    /// * `reason` - Description of error
22    /// * `source` - Underlying error that caused the failure
23    #[error("Initialization error: {reason}")]
24    InitializationError {
25        reason: String,
26        #[source]
27        source: Option<Box<dyn SourceError + Send + Sync>>,
28    },
29
30    /// Anyhow for other errors
31    #[error(transparent)]
32    Other(#[from] AnyhowError),
33}