From 93a567ca945bd1f8a04b6453e59e0dbaeed0fcb3 Mon Sep 17 00:00:00 2001 From: Leon Henrik Plickat Date: Sun, 4 Jun 2023 06:45:01 +0200 Subject: [PATCH] riverctl: Add error messages for failed connections --- riverctl/main.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/riverctl/main.zig b/riverctl/main.zig index b3861c3..80f6fb4 100644 --- a/riverctl/main.zig +++ b/riverctl/main.zig @@ -47,8 +47,6 @@ pub const Globals = struct { pub fn main() !void { _main() catch |err| { - if (builtin.mode == .Debug) return err; - switch (err) { error.RiverControlNotAdvertised => fatal( \\The Wayland server does not support river-control-unstable-v1. @@ -57,6 +55,14 @@ pub fn main() !void { error.SeatNotAdverstised => fatal( \\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, } };