single_instance/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum SingleInstanceError {
5    #[cfg(target_os = "linux")]
6    #[error("new abstract addr error")]
7    Nix(#[from] nix::Error),
8
9    #[cfg(target_os = "macos")]
10    #[error("file open or create error")]
11    Io(#[from] std::io::Error),
12
13    #[cfg(target_os = "windows")]
14    #[error("wide string null error")]
15    Nul(#[from] widestring::NulError<widestring::WideChar>),
16
17    #[cfg(target_os = "windows")]
18    #[error("CreateMutex failed with error code {0}")]
19    MutexError(u32),
20}
21
22pub type Result<T> = std::result::Result<T, SingleInstanceError>;