This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pt/members/libpt-log/src/error.rs

24 lines
777 B
Rust

//! # Error module for [`pt-log`](crate)
//!
//! This module handles errors in logging contexts.
use anyhow;
use thiserror::Error;
use tracing::subscriber::SetGlobalDefaultError;
/// ## Errors for the [Logger](super::Logger)
#[derive(Error, Debug)]
pub enum Error {
/// Bad IO operation
#[error("Bad IO operation")]
IO(#[from] std::io::Error),
/// Various errors raised when the messenger is used in a wrong way
#[error("Bad usage")]
Usage(String),
/// Could not assign logger as the global default
#[error("Could not assign logger as global default")]
SetGlobalDefaultFail(#[from] SetGlobalDefaultError),
/// any other error type, wrapped in [anyhow::Error](anyhow::Error)
#[error(transparent)]
Other(#[from] anyhow::Error),
}