forked from Cutieguwu/raven
Most of the refactor. Need to switch machines.
This commit is contained in:
35
retired/nest_lib_rs_old/error.rs
Normal file
35
retired/nest_lib_rs_old/error.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use std::sync::{MutexGuard, PoisonError, TryLockError};
|
||||
|
||||
use derive_more::{Display, From};
|
||||
use path::PathHandler;
|
||||
|
||||
pub type Result<T> = core::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug, From, Display)]
|
||||
pub enum Error {
|
||||
#[from]
|
||||
Io(std::io::Error),
|
||||
|
||||
MutexLock(String),
|
||||
|
||||
MutexTryLock(String),
|
||||
|
||||
PathSub,
|
||||
|
||||
#[from]
|
||||
Toml(toml::de::Error),
|
||||
|
||||
MissingPathHandler,
|
||||
}
|
||||
|
||||
impl From<PoisonError<MutexGuard<'_, PathHandler>>> for Error {
|
||||
fn from(value: PoisonError<MutexGuard<PathHandler>>) -> Self {
|
||||
Self::MutexLock(value.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TryLockError<MutexGuard<'_, PathHandler>>> for Error {
|
||||
fn from(value: TryLockError<MutexGuard<PathHandler>>) -> Self {
|
||||
Self::MutexTryLock(value.to_string())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user