mirror of
https://github.com/lexmount/moli.git
synced 2026-10-30 16:07:24 +00:00
fix(worker): omit the error value when reporting nested worker failures
Propagate an unhandled nested worker exception to the parent worker with ErrorEvent.error set to null, as required by omitError reporting. Update the existing end-to-end parent onerror regression to inspect the null value while retaining filename, line, column, and message checks.
This commit is contained in:
@@ -2677,7 +2677,16 @@ async fn worker_main(
|
||||
callback_context: None,
|
||||
exception: None,
|
||||
};
|
||||
if !dispatch_worker_error_event(scope, global, &report, None, &script_url) {
|
||||
// Propagation to the owner's global uses omitError: the
|
||||
// child exception cannot cross the worker agent boundary.
|
||||
let omitted_error = v8::null(scope).into();
|
||||
if !dispatch_worker_error_event(
|
||||
scope,
|
||||
global,
|
||||
&report,
|
||||
Some(omitted_error),
|
||||
&script_url,
|
||||
) {
|
||||
report_exception_to_parent(
|
||||
&report,
|
||||
&script_url,
|
||||
|
||||
@@ -899,7 +899,7 @@ async fn nested_worker_unhandled_error_routes_through_parent_worker_onerror() {
|
||||
postMessage({
|
||||
messageIncludesBoom: String(message).includes("child-boom"),
|
||||
filenameIncludesDataUrl: String(filename).includes("data:text/javascript"),
|
||||
errorIsUndefined: error === undefined
|
||||
errorIsNull: error === null
|
||||
});
|
||||
close();
|
||||
return true;
|
||||
@@ -916,7 +916,7 @@ async fn nested_worker_unhandled_error_routes_through_parent_worker_onerror() {
|
||||
.expect("channel closed");
|
||||
assert_eq!(
|
||||
expect_post_json(msg),
|
||||
r#"{"messageIncludesBoom":true,"filenameIncludesDataUrl":true,"errorIsUndefined":true}"#
|
||||
r#"{"messageIncludesBoom":true,"filenameIncludesDataUrl":true,"errorIsNull":true}"#
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user