1pub type Result<T> = std::result::Result<T, Error>;
3
4#[non_exhaustive]
6#[derive(thiserror::Error, Debug)]
7pub enum Error {
8 #[cfg(gtk)]
9 #[error(transparent)]
10 GlibError(#[from] gtk::glib::Error),
11 #[cfg(gtk)]
12 #[error(transparent)]
13 GlibBoolError(#[from] gtk::glib::BoolError),
14 #[cfg(gtk)]
15 #[error("Fail to fetch security manager")]
16 MissingManager,
17 #[cfg(gtk)]
18 #[error("Couldn't find X11 Display")]
19 X11DisplayNotFound,
20 #[cfg(gtk)]
21 #[error(transparent)]
22 XlibError(#[from] x11_dl::error::OpenError),
23 #[error("Failed to initialize the script")]
24 InitScriptError,
25 #[error("Bad RPC request: {0} ((1))")]
26 RpcScriptError(String, String),
27 #[error(transparent)]
28 NulError(#[from] std::ffi::NulError),
29 #[error(transparent)]
30 ReceiverError(#[from] std::sync::mpsc::RecvError),
31 #[error(transparent)]
32 SenderError(#[from] std::sync::mpsc::SendError<String>),
33 #[error("Failed to send the message")]
34 MessageSender,
35 #[error(transparent)]
36 Json(#[from] serde_json::Error),
37 #[error(transparent)]
38 UrlError(#[from] url::ParseError),
39 #[error("IO error: {0}")]
40 Io(#[from] std::io::Error),
41 #[cfg(target_os = "windows")]
42 #[error("WebView2 error: {0}")]
43 WebView2Error(webview2_com::Error),
44 #[error("Duplicate custom protocol registered: {0}")]
45 DuplicateCustomProtocol(String),
46 #[error(transparent)]
47 HttpError(#[from] http::Error),
48 #[error("Infallible error, something went really wrong: {0}")]
49 Infallible(#[from] std::convert::Infallible),
50 #[cfg(target_os = "android")]
51 #[error(transparent)]
52 JniError(#[from] jni::errors::Error),
53 #[error("Failed to create proxy endpoint")]
54 ProxyEndpointCreationFailed,
55 #[error(transparent)]
56 WindowHandleError(#[from] raw_window_handle::HandleError),
57 #[error("the window handle kind is not supported")]
58 UnsupportedWindowHandle,
59 #[error(transparent)]
60 Utf8Error(#[from] std::str::Utf8Error),
61}