riverctl: Add error messages for failed connections

This commit is contained in:
Leon Henrik Plickat 2023-06-04 06:45:01 +02:00 committed by Isaac Freund
parent 6e2169a149
commit 93a567ca94
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -47,8 +47,6 @@ pub const Globals = struct {
pub fn main() !void { pub fn main() !void {
_main() catch |err| { _main() catch |err| {
if (builtin.mode == .Debug) return err;
switch (err) { switch (err) {
error.RiverControlNotAdvertised => fatal( error.RiverControlNotAdvertised => fatal(
\\The Wayland server does not support river-control-unstable-v1. \\The Wayland server does not support river-control-unstable-v1.
@ -57,6 +55,14 @@ pub fn main() !void {
error.SeatNotAdverstised => fatal( error.SeatNotAdverstised => fatal(
\\The Wayland server did not advertise any seat. \\The Wayland server did not advertise any seat.
, .{}), , .{}),
error.ConnectFailed => {
std.log.err("Unable to connect to the Wayland server.", .{});
if (os.getenvZ("WAYLAND_DISPLAY") == null) {
fatal("WAYLAND_DISPLAY is not set.", .{});
} else {
fatal("Does WAYLAND_DISPLAY contain the socket name of a running server?", .{});
}
},
else => return err, else => return err,
} }
}; };