Skip to main content

dear_imgui_wgpu/
error.rs

1//! Error types for the WGPU renderer
2
3use thiserror::Error;
4
5/// Result type for renderer operations
6pub type RendererResult<T> = Result<T, RendererError>;
7
8/// Errors that can occur during rendering operations
9#[derive(Error, Debug)]
10pub enum RendererError {
11    /// Generic error with message
12    #[error("Renderer error: {0}")]
13    Generic(String),
14
15    /// Bad texture error
16    #[error("Bad texture error: {0}")]
17    BadTexture(String),
18
19    /// Device lost error
20    #[error("Device lost")]
21    DeviceLost,
22
23    /// Invalid render state
24    #[error("Invalid render state: {0}")]
25    InvalidRenderState(String),
26
27    /// Buffer creation failed
28    #[error("Buffer creation failed: {0}")]
29    BufferCreationFailed(String),
30
31    /// Texture creation failed
32    #[error("Texture creation failed: {0}")]
33    TextureCreationFailed(String),
34
35    /// Pipeline creation failed
36    #[error("Pipeline creation failed: {0}")]
37    PipelineCreationFailed(String),
38
39    /// Shader compilation failed
40    #[error("Shader compilation failed: {0}")]
41    ShaderCompilationFailed(String),
42
43    /// WGPU error
44    #[error("WGPU error")]
45    Wgpu(#[from] wgpu::Error),
46
47    /// Invalid texture ID
48    #[error("Invalid texture ID: {0}")]
49    InvalidTextureId(u64),
50}
51
52// Display and Error traits are automatically implemented by thiserror