x11: Improve error handling (#32913)
Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4. With this change, there are now only a few spots that explicitly panic, though errors during initialization will panic. Motivation was this recent user panic in `handle_event`, figured fixing all this use of unwrap was a great use of the agent. > called `Result::unwrap()` on an `Err` value: X11 GetProperty for _NET_WM_STATE failed. Release Notes: - N/A
This commit is contained in:
parent
90aa99bb14
commit
aa1b2d74ee
3 changed files with 407 additions and 304 deletions
|
@ -93,6 +93,9 @@ pub(crate) fn current_platform(headless: bool) -> Rc<dyn Platform> {
|
|||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
pub(crate) fn current_platform(headless: bool) -> Rc<dyn Platform> {
|
||||
#[cfg(feature = "x11")]
|
||||
use anyhow::Context as _;
|
||||
|
||||
if headless {
|
||||
return Rc::new(HeadlessClient::new());
|
||||
}
|
||||
|
@ -102,7 +105,11 @@ pub(crate) fn current_platform(headless: bool) -> Rc<dyn Platform> {
|
|||
"Wayland" => Rc::new(WaylandClient::new()),
|
||||
|
||||
#[cfg(feature = "x11")]
|
||||
"X11" => Rc::new(X11Client::new()),
|
||||
"X11" => Rc::new(
|
||||
X11Client::new()
|
||||
.context("Failed to initialize X11 client.")
|
||||
.unwrap(),
|
||||
),
|
||||
|
||||
"Headless" => Rc::new(HeadlessClient::new()),
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue