layer_shika_adapters/
errors.rs1use layer_shika_domain::errors::DomainError;
2use slint::{PlatformError, platform::SetPlatformError};
3use smithay_client_toolkit::reexports::calloop;
4use std::error::Error;
5use std::result::Result as StdResult;
6use thiserror::Error;
7use wayland_client::backend::WaylandError;
8use wayland_client::{
9 ConnectError, DispatchError,
10 globals::{BindError, GlobalError},
11};
12
13pub type Result<T> = StdResult<T, LayerShikaError>;
14
15#[derive(Error, Debug)]
16pub enum RenderingError {
17 #[error("failed to swap buffers")]
18 SwapBuffers {
19 #[source]
20 source: Box<dyn Error + Send + Sync>,
21 },
22
23 #[error("failed to ensure context current")]
24 EnsureContextCurrent {
25 #[source]
26 source: Box<dyn Error + Send + Sync>,
27 },
28
29 #[error("rendering operation failed: {message}")]
30 Operation { message: String },
31}
32
33#[derive(Error, Debug)]
34pub enum EGLError {
35 #[error("failed to create EGL display")]
36 DisplayCreation {
37 #[source]
38 source: Box<dyn Error + Send + Sync>,
39 },
40
41 #[error("failed to find EGL configurations")]
42 ConfigSelection {
43 #[source]
44 source: Box<dyn Error + Send + Sync>,
45 },
46
47 #[error("no compatible EGL configurations found")]
48 NoCompatibleConfig,
49
50 #[error("failed to create EGL context")]
51 ContextCreation {
52 #[source]
53 source: Box<dyn Error + Send + Sync>,
54 },
55
56 #[error("failed to create window surface")]
57 SurfaceCreation {
58 #[source]
59 source: Box<dyn Error + Send + Sync>,
60 },
61
62 #[error("failed to make context current")]
63 MakeCurrent {
64 #[source]
65 source: Box<dyn Error + Send + Sync>,
66 },
67
68 #[error("failed to swap buffers")]
69 SwapBuffers {
70 #[source]
71 source: Box<dyn Error + Send + Sync>,
72 },
73}
74
75#[derive(Error, Debug)]
76pub enum EventLoopError {
77 #[error("failed to create event loop")]
78 Creation {
79 #[source]
80 source: calloop::Error,
81 },
82
83 #[error("failed to insert event source: {message}")]
84 InsertSource { message: String },
85
86 #[error("event loop execution failed")]
87 Execution {
88 #[source]
89 source: calloop::Error,
90 },
91}
92
93#[derive(Error, Debug)]
94pub enum LayerShikaError {
95 #[error("domain error")]
96 Domain {
97 #[from]
98 source: DomainError,
99 },
100
101 #[error("failed to connect to Wayland display")]
102 WaylandConnection {
103 #[from]
104 source: ConnectError,
105 },
106
107 #[error("failed to initialize Wayland globals")]
108 GlobalInitialization {
109 #[source]
110 source: GlobalError,
111 },
112
113 #[error("Wayland dispatch error")]
114 WaylandDispatch {
115 #[from]
116 source: DispatchError,
117 },
118
119 #[error("failed to bind Wayland global")]
120 GlobalBind {
121 #[from]
122 source: BindError,
123 },
124
125 #[error("EGL context error")]
126 EGLContext {
127 #[from]
128 source: EGLError,
129 },
130
131 #[error("failed to create FemtoVG renderer")]
132 FemtoVGRendererCreation {
133 #[source]
134 source: PlatformError,
135 },
136
137 #[error("failed to create Slint component")]
138 SlintComponentCreation {
139 #[source]
140 source: PlatformError,
141 },
142
143 #[error("event loop error")]
144 EventLoop {
145 #[from]
146 source: EventLoopError,
147 },
148
149 #[error("window configuration error: {message}")]
150 WindowConfiguration { message: String },
151
152 #[error("rendering error")]
153 Rendering {
154 #[from]
155 source: RenderingError,
156 },
157
158 #[error("invalid input: {message}")]
159 InvalidInput { message: String },
160
161 #[error("Wayland protocol error")]
162 WaylandProtocol {
163 #[source]
164 source: WaylandError,
165 },
166
167 #[error("failed to set up Slint platform")]
168 PlatformSetup {
169 #[source]
170 source: SetPlatformError,
171 },
172}