cvkg_render_native/
error.rs1use std::fmt;
7
8#[derive(Debug)]
10pub enum NativeError {
11 WindowCreation(String),
13 GpuInit(String),
15 DiffEmpty,
17 WindowDestroyed(winit::window::WindowId),
19 EventLoop(String),
21}
22
23impl fmt::Display for NativeError {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 match self {
26 NativeError::WindowCreation(msg) => write!(
27 f,
28 "Window creation failed: {msg}. Check display server connection."
29 ),
30 NativeError::GpuInit(msg) => write!(
31 f,
32 "GPU initialization failed: {msg}. Verify drivers and GPU availability."
33 ),
34 NativeError::DiffEmpty => write!(
35 f,
36 "VDom diff produced no patches but rebuild was expected. This is a bug."
37 ),
38 NativeError::WindowDestroyed(id) => write!(
39 f,
40 "Window {id:?} was destroyed but events are still being dispatched."
41 ),
42 NativeError::EventLoop(msg) => write!(f, "Event loop error: {msg}"),
43 }
44 }
45}
46
47impl std::error::Error for NativeError {}