diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-26 00:59:31 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-06-26 00:59:31 +0200 |
| commit | 79bb0accacc1ada0920710e7b534b485cd60f856 (patch) | |
| tree | 349f1bf511db9bd427adbc6a233ac61db6bdf3ad /riverctl/main.zig | |
| parent | 8fc045b445c0df32d726d217376825be64b8f7db (diff) | |
| download | river-79bb0accacc1ada0920710e7b534b485cd60f856.tar.gz river-79bb0accacc1ada0920710e7b534b485cd60f856.tar.xz | |
code: improve error handling consistency
Diffstat (limited to 'riverctl/main.zig')
| -rw-r--r-- | riverctl/main.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/riverctl/main.zig b/riverctl/main.zig index 8e02a06..ec804d7 100644 --- a/riverctl/main.zig +++ b/riverctl/main.zig @@ -36,11 +36,10 @@ var river_control_optional: ?*c.zriver_control_v1 = null; var wl_seat_optional: ?*c.wl_seat = null; pub fn main() !void { - const wl_display = c.wl_display_connect(null) orelse return error.CantConnectToDisplay; + const wl_display = c.wl_display_connect(null) orelse return error.ConnectError; const wl_registry = c.wl_display_get_registry(wl_display); - if (c.wl_registry_add_listener(wl_registry, &wl_registry_listener, null) < 0) - return error.FailedToAddListener; + if (c.wl_registry_add_listener(wl_registry, &wl_registry_listener, null) < 0) unreachable; if (c.wl_display_roundtrip(wl_display) < 0) return error.RoundtripFailed; const river_control = river_control_optional orelse return error.RiverControlNotAdvertised; @@ -56,7 +55,7 @@ pub fn main() !void { command_callback, &command_callback_listener, null, - ) < 0) return error.FailedToAddListener; + ) < 0) unreachable; // Loop until our callback is called and we exit. while (true) if (c.wl_display_dispatch(wl_display) < 0) return error.DispatchFailed; |
