Big refacto

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-04-16 00:38:06 +02:00
parent 5e1fe656e8
commit 980571073d
4 changed files with 160 additions and 192 deletions

View File

@@ -1,11 +1,26 @@
const std = @import("std");
const server = @import("../server.zig");
const Ctx = server.CmdContext;
const SendFn = server.SendFn;
const Ctx = server.Cmd;
const browser = @import("browser.zig").browser;
const target = @import("target.zig").target;
pub const Error = error{
UnknonwDomain,
UnknownMethod,
};
pub fn isCdpError(err: anyerror) ?Error {
// see https://github.com/ziglang/zig/issues/2473
const errors = @typeInfo(Error).ErrorSet.?;
inline for (errors) |e| {
if (std.mem.eql(u8, e.name, @errorName(err))) {
return @errorCast(err);
}
}
return null;
}
const Domains = enum {
Browser,
Target,