Skip to content

Commit 74f7ba5

Browse files
elverskogjinzhongjia
authored andcommitted
update for better return is-not-void error handling
1 parent c5108b0 commit 74f7ba5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/webui.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,11 @@ pub fn binding(self: webui, element: [:0]const u8, comptime callback: anytype) !
773773

774774
const fnInfo = TInfo.@"fn";
775775
// Verify return type is void
776-
if (fnInfo.return_type != void) {
776+
const Ret = fnInfo.return_type orelse @compilerError("return_type can't be null");
777+
if (Ret != void) {
777778
const err_msg = std.fmt.comptimePrint(
778779
"callback's return type ({}), it must be void!",
779-
.{fnInfo.return_type},
780+
.{Ret},
780781
);
781782
@compileError(err_msg);
782783
}

0 commit comments

Comments
 (0)