(no title)
srcreigh | 13 days ago
// sqlite.zig
pub const ErrorPayload = struct {
message: [256]u8,
pub fn init(db: *c.sqlite3) @This() {
var self = std.mem.zeroes(@This());
var fw = std.Io.Writer.fixed(self.message[0..]);
_ = fw.writeAll(std.mem.span(c.sqlite3_errmsg(db))) catch |err| switch (err) {
error.WriteFailed => return self, // full
};
return self;
}
};
latch|13 days ago
srcreigh|13 days ago
If I really needed a large error payload, too big to fit on the stack, I'd probably want to do something like this:
dns_snek|13 days ago