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 #[cfg(target_os = "android")]
32 #[error(transparent)]
33 ReceiverTimeoutError(#[from] crossbeam_channel::RecvTimeoutError),
34 #[error(transparent)]
35 SenderError(#[from] std::sync::mpsc::SendError<String>),
36 #[error("Failed to send the message")]
37 MessageSender,
38 #[error("IO error: {0}")]
39 Io(#[from] std::io::Error),
40 #[cfg(target_os = "windows")]
41 #[error("WebView2 error: {0}")]
42 WebView2Error(webview2_com::Error),
43 #[error(transparent)]
44 HttpError(#[from] http::Error),
45 #[error("Infallible error, something went really wrong: {0}")]
46 Infallible(#[from] std::convert::Infallible),
47 #[cfg(target_os = "android")]
48 #[error(transparent)]
49 JniError(#[from] jni::errors::Error),
50 #[error("Failed to create proxy endpoint")]
51 ProxyEndpointCreationFailed,
52 #[error(transparent)]
53 WindowHandleError(#[from] raw_window_handle::HandleError),
54 #[error("the window handle kind is not supported")]
55 UnsupportedWindowHandle,
56 #[error(transparent)]
57 Utf8Error(#[from] std::str::Utf8Error),
58 #[cfg(target_os = "android")]
59 #[error(transparent)]
60 CrossBeamRecvError(#[from] crossbeam_channel::RecvError),
61 #[error("not on the main thread")]
62 NotMainThread,
63 #[error("Custom protocol task is invalid.")]
64 CustomProtocolTaskInvalid,
65 #[error("Failed to register URL scheme: {0}, could be due to invalid URL scheme or the scheme is already registered.")]
66 UrlSchemeRegisterError(String),
67 #[error("Duplicate custom protocol registered on Linux: {0}")]
68 DuplicateCustomProtocol(String),
69 #[error("Duplicate custom protocol registered on the same web context on Linux: {0}")]
70 ContextDuplicateCustomProtocol(String),
71 #[error(transparent)]
72 #[cfg(any(target_os = "macos", target_os = "ios"))]
73 UrlPrase(#[from] url::ParseError),
74 #[cfg(any(target_os = "macos", target_os = "ios"))]
75 #[error("data store is currently opened")]
76 DataStoreInUse,
77}