mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 23:24:37 +00:00
fix(cli/worker): Print error stacks from the origin Worker (#7987)
Fixes #4728
This commit is contained in:
parent
57e95032c8
commit
7aba07cc77
12 changed files with 172 additions and 46 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
((window) => {
|
||||
const core = window.Deno.core;
|
||||
const { Window } = window.__bootstrap.globalInterfaces;
|
||||
const { log } = window.__bootstrap.util;
|
||||
|
||||
function createWorker(
|
||||
|
@ -142,7 +143,14 @@
|
|||
if (type === "terminalError") {
|
||||
this.#terminated = true;
|
||||
if (!this.#handleError(event.error)) {
|
||||
throw Error(event.error.message);
|
||||
if (globalThis instanceof Window) {
|
||||
throw new Error("Unhandled error event reached main worker.");
|
||||
} else {
|
||||
core.jsonOpSync(
|
||||
"op_host_unhandled_error",
|
||||
{ message: event.error.message },
|
||||
);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -154,7 +162,14 @@
|
|||
|
||||
if (type === "error") {
|
||||
if (!this.#handleError(event.error)) {
|
||||
throw Error(event.error.message);
|
||||
if (globalThis instanceof Window) {
|
||||
throw new Error("Unhandled error event reached main worker.");
|
||||
} else {
|
||||
core.jsonOpSync(
|
||||
"op_host_unhandled_error",
|
||||
{ message: event.error.message },
|
||||
);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue