use thiserror::Error;
use tokio::task::JoinError;
#[derive(Debug, Error)]
pub enum NvmlError {
#[error("Unknow metric \"{0}\" found in old snapshot")]
UnknownMetricError(String),
#[error(
"No driver found or loaded to access NVML, check whether you have an Nvidia GPU or not"
)]
NoDriverLoaded,
#[error("Insufficient permissions to access NVML. Try running with sudo")]
NoPermission,
#[error("No GPU device detected.")]
NoDeviceDetected,
#[error("NVML error: {0}")]
NvmlError(
#[from]
#[source]
nvml_wrapper::error::NvmlError,
),
#[error("I/O error")]
Io(
#[from]
#[source]
std::io::Error,
),
#[error("Device with index {0} not found.")]
NoSuchDeviceFromIndex(usize),
#[error("Failed to join tokio task: {0}")]
JoinError(
#[from]
#[source]
JoinError,
),
#[error("NVML source mutex poisoned.")]
MutexPoisoned,
}