1use std::{io, result};
2
3use drm::buffer::UnrecognizedFourcc;
4use thiserror::Error;
5use wayland_client::{
6 ConnectError, DispatchError,
7 globals::{BindError, GlobalError},
8};
9
10pub type Result<T, E = Error> = result::Result<T, E>;
11
12#[derive(Error, Debug)]
13pub enum Error {
14 #[error("no outputs supplied")]
15 NoOutputs,
16 #[error("image buffer is not big enough")]
17 BufferTooSmall,
18 #[error("image color type not supported")]
19 InvalidColor,
20 #[error("IO error: {0}")]
21 Io(#[from] io::Error),
22 #[error("dispatch error: {0}")]
23 Dispatch(#[from] DispatchError),
24 #[error("bind error: {0}")]
25 Bind(#[from] BindError),
26 #[error("global error: {0}")]
27 Global(#[from] GlobalError),
28 #[error("connect error: {0}")]
29 Connect(#[from] ConnectError),
30 #[error("framecopy failed")]
31 FramecopyFailed,
32 #[error("No supported buffer format")]
33 NoSupportedBufferFormat,
34 #[error("Cannot find required wayland protocol")]
35 ProtocolNotFound(String),
36 #[error("error occurred in freeze callback")]
37 FreezeCallbackError(String),
38 #[error(
39 "dmabuf configuration not initialized. Did you not use Wayshot::from_connection_with_dmabuf()?"
40 )]
41 NoDMAStateError,
42 #[error("dmabuf color format provided by compositor is invalid")]
43 UnrecognizedColorCode(#[from] UnrecognizedFourcc),
44 #[error("dmabuf device has been destroyed")]
45 EGLError(#[from] khronos_egl::Error),
46 #[error("No EGLImageTargetTexture2DOES function located, this extension may not be supported")]
47 EGLImageToTexProcNotFoundError,
48}