diff options
| author | Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de> | 2021-03-27 11:36:47 +0100 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2021-03-27 12:17:47 +0100 |
| commit | f99071f1da44c23ef6d984c1f2d58e32f3a052ba (patch) | |
| tree | 43238abe9bdf5cf6f1f4137177bb81118bd5240d /riverctl | |
| parent | 979e64050780b6c7d40f372da7f3f4acdf16d822 (diff) | |
| download | river-f99071f1da44c23ef6d984c1f2d58e32f3a052ba.tar.gz river-f99071f1da44c23ef6d984c1f2d58e32f3a052ba.tar.xz | |
riverctl: Print error messages instead of error traces for common user mistakes
Diffstat (limited to 'riverctl')
| -rw-r--r-- | riverctl/main.zig | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/riverctl/main.zig b/riverctl/main.zig index 1f64233..9df4e4d 100644 --- a/riverctl/main.zig +++ b/riverctl/main.zig @@ -44,6 +44,35 @@ pub const Globals = struct { }; pub fn main() !void { + _main() catch |err| { + if (std.builtin.mode == .Debug) + return err; + + switch (err) { + error.RiverControlNotAdvertised => printErrorExit( + \\The Wayland server does not support river-control-unstable-v1. + \\Do your versions of river and riverctl match? + , .{}), + error.RiverStatusManagerNotAdvertised => printErrorExit( + \\The Wayland server does not support river-status-unstable-v1. + \\Do your versions of river and riverctl match? + , .{}), + error.RiverOptionsManagerNotAdvertised => printErrorExit( + \\The Wayland server does not support river-options-unstable-v1. + \\Do your versions of river and riverctl match? + , .{}), + error.SeatNotAdverstised => printErrorExit( + \\The Wayland server did not advertise any seat. + , .{}), + error.XdgOutputNotAdvertised => printErrorExit( + \\The Wayland server does not support xdg-output-unstable-v1. + , .{}), + else => return err, + } + }; +} + +fn _main() !void { const display = try wl.Display.connect(null); const registry = try display.getRegistry(); |
