ec_gpu_gen/
error.rs

1use std::io;
2
3#[cfg(any(feature = "cuda", feature = "opencl"))]
4use rust_gpu_tools::GPUError;
5
6/// Errors of this library.
7#[derive(thiserror::Error, Debug)]
8pub enum EcError {
9    /// A simple error that is described by a string.
10    #[error("EcError: {0}")]
11    Simple(&'static str),
12
13    /// Error in case a GPU kernel execution was aborted.
14    #[cfg(any(feature = "cuda", feature = "opencl"))]
15    #[error("GPU call was aborted!")]
16    Aborted,
17
18    /// An error that is bubbled up from the rust-gpu-tools library.
19    #[cfg(any(feature = "cuda", feature = "opencl"))]
20    #[error("GPU tools error: {0}")]
21    GpuTools(#[from] GPUError),
22
23    /// IO error.
24    #[error("Encountered an I/O error: {0}")]
25    Io(#[from] io::Error),
26}
27
28/// Result wrapper that is always using [`EcError`] as error.
29pub type EcResult<T> = std::result::Result<T, EcError>;