cdp: check parameter's type on sendEvent

Disallow void type.
This commit is contained in:
Pierre Tachoire
2025-01-28 16:01:47 +01:00
parent fc59a0f6ab
commit 8aac26a331

View File

@@ -206,6 +206,9 @@ pub fn sendEvent(
params: T, params: T,
sessionID: ?[]const u8, sessionID: ?[]const u8,
) !void { ) !void {
// some clients like chromedp expects empty parameters structs.
if (T == void) @compileError("sendEvent: use struct{} instead of void for empty parameters");
log_cdp.debug("Event > method {s}, sessionID {?s}", .{ name, sessionID }); log_cdp.debug("Event > method {s}, sessionID {?s}", .{ name, sessionID });
const Resp = struct { const Resp = struct {
method: []const u8, method: []const u8,