From 445c01c7862c69e439d8695c63ff2ef0b90c75c4 Mon Sep 17 00:00:00 2001 From: s-ol Date: Mon, 22 Sep 2025 17:31:11 +0200 Subject: log errors in threads --- src/gl.zig | 9 +++++---- src/tsv.zig | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gl.zig b/src/gl.zig index bd43b5b..87fc9cb 100644 --- a/src/gl.zig +++ b/src/gl.zig @@ -902,17 +902,18 @@ pub const Thread = struct { return thread; } - pub const InitFn = fn (*Thread, *const Constants, anytype) anyerror!void; + pub const InitFn = fn (*Thread, *const Constants, anytype) void; fn runner(comptime f: anytype) InitFn { - const ReturnType = @typeInfo(@TypeOf(f)).@"fn".return_type.?; const Impl = struct { - pub fn init(self: *Thread, constants: *const Constants, args: anytype) ReturnType { + pub fn init(self: *Thread, constants: *const Constants, args: anytype) void { c.glfwWindowHint(c.GLFW_VISIBLE, c.GLFW_FALSE); self.window = c.glfwCreateWindow(200, 200, "glsl-view Thread", null, constants.main_window) orelse unreachable; c.glfwMakeContextCurrent(self.window); - return @call(.auto, f, args); + @call(.auto, f, args) catch |err| { + std.debug.print("Error in thread: {}\n", .{err}); + }; } }; diff --git a/src/tsv.zig b/src/tsv.zig index ae052d4..cc6d6d6 100644 --- a/src/tsv.zig +++ b/src/tsv.zig @@ -83,7 +83,7 @@ pub const TSVSource = struct { 2000, 2000, 2000, - ) orelse unreachable; + ) orelse return error.tsvError; const guard = c.gl_client_find_image_data(client, self.name, false) orelse return error.notFound; defer c.gl_client_image_data_guard_destroy(guard); -- cgit v1.2.3