safelog/err.rs
1//! Declare an error type.
2
3/// An error returned when attempting to enforce or disable safe logging.
4#[derive(Clone, Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7 /// Tried to call [`disable_safe_logging`](crate::disable_safe_logging), but
8 /// `enforce_safe_logging` was already called.
9 #[error("Cannot enable unsafe logging: safe logging is already enforced")]
10 AlreadySafe,
11
12 /// Tried to call [`enforce_safe_logging`](crate::enforce_safe_logging), but
13 /// `disable_safe_logging` was already called.
14 #[error("Cannot enforce safe logging: unsafe logging is already enabled")]
15 AlreadyUnsafe,
16
17 /// One of the `enable`/`disable` functions was called so many times that we
18 /// could not keep count of how many guards there were.
19 ///
20 /// This should generally be impossible, and probably represents an error in
21 /// your program.
22 #[error("Too many calls to enforce or disable safe logging")]
23 Overflow,
24}