feat(bake): handle bundle errors, re-assemble full client payloads, initial error modal (#14504)

This commit is contained in:
dave caruso
2024-10-14 16:49:38 -07:00
committed by GitHub
parent 29d287261b
commit d2fe1ce1c8
27 changed files with 2596 additions and 1317 deletions

View File

@@ -1520,7 +1520,7 @@ pub fn dumpStackTrace(trace: std.builtin.StackTrace) void {
.action = .view_trace,
.reason = .{ .zig_error = error.DumpStackTrace },
.trace = &trace,
}});
}}) catch {};
return;
}
@@ -1601,6 +1601,49 @@ pub fn dumpStackTrace(trace: std.builtin.StackTrace) void {
stderr.writeAll(proc.stderr) catch return;
}
/// A variant of `std.builtin.StackTrace` that stores its data within itself
/// instead of being a pointer. This allows storing captured stack traces
/// for later printing.
pub const StoredTrace = struct {
data: [31]usize,
index: usize,
pub const empty: StoredTrace = .{
.data = .{0} ** 31,
.index = 0,
};
pub fn trace(stored: *StoredTrace) std.builtin.StackTrace {
return .{
.index = stored.index,
.instruction_addresses = &stored.data,
};
}
pub fn capture(begin: ?usize) StoredTrace {
var stored: StoredTrace = StoredTrace.empty;
var frame = stored.trace();
std.debug.captureStackTrace(begin orelse @returnAddress(), &frame);
stored.index = frame.index;
return stored;
}
pub fn from(stack_trace: ?*std.builtin.StackTrace) StoredTrace {
if (stack_trace) |stack| {
var data: [31]usize = undefined;
@memset(&data, 0);
const items = @min(stack.instruction_addresses.len, 31);
@memcpy(data[0..items], stack.instruction_addresses[0..items]);
return .{
.data = data,
.index = @min(items, stack.index),
};
} else {
return empty;
}
}
};
pub const js_bindings = struct {
const JSC = bun.JSC;
const JSValue = JSC.JSValue;