#[non_exhaustive]pub enum ShellError {
NoBackend {
tried: String,
},
UnknownBackend {
requested: String,
available: String,
},
Connect {
backend: ShellBackend,
detail: String,
},
Disconnected {
backend: ShellBackend,
detail: String,
},
InvalidWindow {
bits: u64,
},
NoSuchMonitor(u32),
WindowCreation(String),
InvalidDescriptor(String),
NoPendingCloseRequest {
window: WindowId,
},
Unsupported {
backend: ShellBackend,
what: &'static str,
},
Backend(String),
NeedsUserInteraction {
backend: ShellBackend,
what: &'static str,
},
}Expand description
A shell operation failed.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoBackend
No backend could be opened.
tried lists the backends that were attempted in order, so the log line
distinguishes “there is no WAYLAND_DISPLAY and no DISPLAY” from “the
Wayland backend is not compiled into this build”. See
open.
UnknownBackend
CRCBL_SHELL named a backend this build does not have.
A hard error rather than a fallback: someone who set the variable wanted that backend, and silently running on a different one turns a debugging session into a wild goose chase.
Fields
Connect
Connecting to the window system failed — no compositor socket, a refused X11 connection, a browser with no canvas.
Fields
backend: ShellBackendBackend that failed to connect.
Disconnected
The connection to the window system was lost mid-session. Nothing the shell owns is usable afterwards.
Distinct from ShellError::Connect because the recovery differs: a
failed connect is a startup problem a user can fix, and a lost
connection means the compositor died or the session ended, which is a
clean-shutdown signal.
Fields
backend: ShellBackendBackend whose connection dropped.
InvalidWindow
A WindowId did not resolve: it was destroyed, never created, or came
from a different shell.
The generational Handle behind WindowId makes
this a clean failure rather than an operation applied to whatever window
took the slot — the same argument as crcbl-hal’s InvalidHandle.
Fields
bits: u64The handle’s packed bits, from
Handle::to_bits.
NoSuchMonitor(u32)
A MonitorId named a monitor that is not connected —
usually one that was unplugged between
monitors and the call that used its id.
WindowCreation(String)
Creating the window failed.
InvalidDescriptor(String)
A descriptor field was out of range or self-inconsistent — a caller bug, which is why the message is expected to name the field.
NoPendingCloseRequest
The reply named a window with no close request outstanding.
An error rather than a no-op because it is always a state-machine bug in the caller: the reply either arrived twice or was addressed to the wrong window, and both silently leave a real close request unanswered.
Unsupported
The operation is real but this backend cannot do it.
Always paired with a ShellCaps flag: a caller that
checks caps first never sees this, and a caller that does not gets an
error naming the capability it should have checked. Getting this back is
the signal that a consumer is missing a caps branch — which is exactly
the platform-sniffing regression ShellCaps exists to prevent.
Backend(String)
Anything else the backend wants to report verbatim.
NeedsUserInteraction
The window system requires a recent user interaction for this, and there has not been one.
§Why this is a named case rather than a backend string
It is a policy, not a fault, and the policy is the same one on three platforms:
- Wayland’s
wl_data_device.set_selectionquotes the serial of the input event that caused the copy, and a compositor checks it. A client that has received no input on a seat cannot take the clipboard. - A browser gates
navigator.clipboard.write()and Pointer Lock behind a user gesture, with the same reasoning and the same failure. - X11 has no such requirement at all, and neither does Win32.
What it prevents is a background process silently taking the clipboard — so a caller must treat it as “ask the user to do that again”, never as a bug to work around. A backend on a platform without the rule never returns this, and that is obviously correct rather than obviously incomplete.
Fields
backend: ShellBackendWhich backend refused.
Implementations§
Source§impl ShellError
impl ShellError
Sourcepub fn invalid_window(window: WindowId) -> Self
pub fn invalid_window(window: WindowId) -> Self
Builds a ShellError::InvalidWindow from a window handle.
Backends call this from their handle-lookup path so the error carries the
same bits that appear in WindowId’s Debug output.
Trait Implementations§
Source§impl Debug for ShellError
impl Debug for ShellError
Source§impl Display for ShellError
impl Display for ShellError
Source§impl Error for ShellError
impl Error for ShellError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()