Skip to content

Get Sentry-like error reporting working #5091

Closed

Description

https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor

  • process.on("unhandledRejection", cb)
  • process.on("unhandledException", cb)
  • process.on("uncaughtExceptionMonitor", cb)
  • process.setUncaughtExceptionCaptureCallback(cb)

This lets Sentry get error reporting working.

Ideally, the fix would go here:

pub const UnhandledRejectionScope = struct {
ctx: ?*anyopaque = null,
onUnhandledRejection: *const OnUnhandledRejection = undefined,
count: usize = 0,
pub fn apply(this: *UnhandledRejectionScope, vm: *JSC.VirtualMachine) void {
vm.onUnhandledRejection = this.onUnhandledRejection;
vm.onUnhandledRejectionCtx = this.ctx;
vm.unhandled_error_counter = this.count;
}
};

We would add an unhandled rejection scope for either rejections or exceptions and have some way to distinguish between the two. This one would call into JS potentially for multiple handlers. The part that gets a little tricky is in unit tests where we rely on this behavior for expect().toThrow()

cc @dcramer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

atwtrackingAn umbrella issue for tracking big featuresAn umbrella issue for tracking big features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions