log error on respondWith rejection,

Former-commit-id: 8f6312a17dc9811d54e4dc31d9ada68e98bae891
This commit is contained in:
Jarred Sumner
2021-08-17 04:10:21 -07:00
parent 1e81d4d2a9
commit 6997367242
9 changed files with 81 additions and 15 deletions

View File

@@ -6,7 +6,20 @@ const JS = @import("../javascript.zig");
const JSBase = @import("../base.zig");
const Handler = struct {
pub export fn global_signal_handler_fn(sig: i32, info: *const std.os.siginfo_t, ctx_ptr: ?*const c_void) callconv(.C) void {
Global.panic("C++ Crash!!", .{});
var stdout = std.io.getStdOut();
var stderr = std.io.getStdErr();
var source = Output.Source.init(stdout, stderr);
Output.Source.set(&source);
if (Output.isEmojiEnabled()) {
Output.prettyErrorln("<r><red>Bun will crash now<r> 😭😭😭\n", .{});
Output.flush();
} else {
stderr.writeAll("Bun has crashed :'(\n") catch {};
}
std.mem.doNotOptimizeAway(source);
std.os.exit(6);
}
};

View File

@@ -1101,7 +1101,8 @@ pub const FetchEvent = struct {
switch (status) {
.Fulfilled => {},
else => {
this.request_context.sendInternalError(error.rejectedPromise) catch {};
VirtualMachine.vm.defaultErrorHandler(resolved.result(VirtualMachine.vm.global.vm()));
this.request_context.sendInternalError(error.rejectedPromiseSeeConsole) catch {};
return js.JSValueMakeUndefined(ctx);
},
}