aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/javascript.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-03-28 18:23:50 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-28 18:23:50 -0700
commitb76384351c55917692a9dc3b7f08f771a55b3fa1 (patch)
tree74a188ed15dac0f194e3e72fed4dd719ae4c601b /src/bun.js/javascript.zig
parent0a914902269ebb1f5612385bd8b65aa1de4db71e (diff)
downloadbun-b76384351c55917692a9dc3b7f08f771a55b3fa1.tar.gz
bun-b76384351c55917692a9dc3b7f08f771a55b3fa1.tar.zst
bun-b76384351c55917692a9dc3b7f08f771a55b3fa1.zip
More bug fixes (#2486)
* readline_promises test fix * fix `escapeHTML` for baseline builds * fs test fixes, use `tmpdir()` * add paths for `resolve.test.js` * isError with toString symbol and error prototype * comment about `toString` * skip async macro transform * test cleanup, skip stack format test * readline undo and redo fix * capture error from readline keypress * Update tcp-server.test.ts * use `removefileat` for recursive rmdir * use strong for `signal.reason` * initialize `m_flags` * directory with file fs test * recursive option * import expect * could be less than * move abort signal tests to another process * fix typecheck --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'src/bun.js/javascript.zig')
-rw-r--r--src/bun.js/javascript.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index f54dd5fb8..3841a07e2 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -362,6 +362,7 @@ pub const VirtualMachine = struct {
uws_event_loop: ?*uws.Loop = null,
pending_unref_counter: i32 = 0,
preload: []const string = &[_][]const u8{},
+ unhandled_pending_rejection_to_capture: ?*JSC.JSValue = null,
/// hide bun:wrap from stack traces
/// bun:wrap is very noisy
@@ -479,6 +480,14 @@ pub const VirtualMachine = struct {
this.unhandled_error_counter += 1;
}
+ pub fn onQuietUnhandledRejectionHandlerCaptureValue(this: *VirtualMachine, _: *JSC.JSGlobalObject, value: JSC.JSValue) void {
+ this.unhandled_error_counter += 1;
+ value.ensureStillAlive();
+ if (this.unhandled_pending_rejection_to_capture) |ptr| {
+ ptr.* = value;
+ }
+ }
+
pub fn unhandledRejectionScope(this: *VirtualMachine) UnhandledRejectionScope {
return .{
.onUnhandledRejection = this.onUnhandledRejection,