use std::error::Error;
use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum WgpuBackendError {
NoAdapter,
CreateSurface(String),
Init(String),
RequestDevice(String),
Surface(wgpu::SurfaceError),
}
impl Display for WgpuBackendError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::NoAdapter => write!(f, "no compatible wgpu adapter found"),
Self::CreateSurface(message) => write!(f, "failed to create surface: {message}"),
Self::Init(message) => write!(f, "failed to initialize renderer: {message}"),
Self::RequestDevice(message) => write!(f, "failed to request device: {message}"),
Self::Surface(error) => write!(f, "surface error: {error}"),
}
}
}
impl Error for WgpuBackendError {}