forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ext/web): Add error events for event listener and timer errors (d…
…enoland#14159) - feat: Add handleable error event for even listener errors - feat: Add handleable error event for setTimeout()/setInterval() errors - feat: Add Deno.core.destructureError() - feat: Add Deno.core.terminate() - fix: Don't throw listener errors from dispatchEvent() - fix: Use biased mode when selecting between mod_evaluate() and run_event_loop() results
- Loading branch information
Showing
35 changed files
with
440 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
addEventListener("foo", () => { | ||
throw new Error("bar"); | ||
}); | ||
console.log(1); | ||
dispatchEvent(new CustomEvent("foo")); | ||
console.log(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
1 | ||
error: Uncaught Error: bar | ||
throw new Error("bar"); | ||
^ | ||
at [WILDCARD]/event_listener_error.ts:2:9 | ||
at [WILDCARD] | ||
at [WILDCARD]/event_listener_error.ts:5:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
addEventListener("error", (event) => { | ||
console.log({ | ||
cancelable: event.cancelable, | ||
message: event.message, | ||
filename: event.filename?.slice?.(-100), | ||
lineno: event.lineno, | ||
colno: event.colno, | ||
error: event.error, | ||
}); | ||
event.preventDefault(); | ||
}); | ||
|
||
onerror = (event) => { | ||
console.log("onerror() called", event.error); | ||
}; | ||
|
||
addEventListener("foo", () => { | ||
throw new Error("bar"); | ||
}); | ||
|
||
console.log(1); | ||
dispatchEvent(new CustomEvent("foo")); | ||
console.log(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
1 | ||
{ | ||
cancelable: true, | ||
message: "Uncaught Error: bar", | ||
filename: "[WILDCARD]/event_listener_error_handled.ts", | ||
lineno: 18, | ||
colno: 9, | ||
error: Error: bar | ||
at [WILDCARD]/event_listener_error_handled.ts:18:9 | ||
at [WILDCARD] | ||
at [WILDCARD]/event_listener_error_handled.ts:22:1 | ||
} | ||
onerror() called Error: bar | ||
at [WILDCARD]/event_listener_error_handled.ts:18:9 | ||
at [WILDCARD] | ||
at [WILDCARD]/event_listener_error_handled.ts:22:1 | ||
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
addEventListener("foo", () => { | ||
queueMicrotask(() => console.log("queueMicrotask")); | ||
setTimeout(() => console.log("timer"), 0); | ||
throw new Error("bar"); | ||
}); | ||
console.log(1); | ||
// @ts-ignore Deno.core | ||
Deno.core.setNextTickCallback(() => console.log("nextTick")); | ||
// @ts-ignore Deno.core | ||
Deno.core.setHasTickScheduled(true); | ||
dispatchEvent(new CustomEvent("foo")); | ||
console.log(2); |
6 changes: 6 additions & 0 deletions
6
cli/tests/testdata/event_listener_error_immediate_exit.ts.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
1 | ||
error: Uncaught Error: bar | ||
throw new Error("bar"); | ||
^ | ||
at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9[WILDCARD] | ||
at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setTimeout(() => { | ||
throw new Error("foo"); | ||
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: Uncaught Error: foo | ||
throw new Error("foo"); | ||
^ | ||
at [WILDCARD]/set_timeout_error.ts:2:9 | ||
at [WILDCARD] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
addEventListener("error", (event) => { | ||
console.log({ | ||
cancelable: event.cancelable, | ||
message: event.message, | ||
filename: event.filename?.slice?.(-100), | ||
lineno: event.lineno, | ||
colno: event.colno, | ||
error: event.error, | ||
}); | ||
event.preventDefault(); | ||
}); | ||
|
||
onerror = (event) => { | ||
console.log("onerror() called", event.error); | ||
}; | ||
|
||
setTimeout(() => { | ||
throw new Error("foo"); | ||
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
cancelable: true, | ||
message: "Uncaught Error: foo", | ||
filename: "[WILDCARD]/set_timeout_error_handled.ts", | ||
lineno: 18, | ||
colno: 9, | ||
error: Error: foo | ||
at [WILDCARD]/set_timeout_error_handled.ts:18:9 | ||
at [WILDCARD] | ||
} | ||
onerror() called Error: foo | ||
at [WILDCARD]/set_timeout_error_handled.ts:18:9 | ||
at [WILDCARD] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[WILDCARD]error: Uncaught (in worker "") Module not found "file:https:///[WILDCARD]/workers/doesnt_exist.js". | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag | ||
at blob:null/[WILDCARD]:1:8 | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag | ||
at blob:null/[WILDCARD]:1:8 | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag | ||
at data:application/javascript;base64,[WILDCARD]:1:8 | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag | ||
at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:8 | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error: Uncaught (in worker "") Requires net access to "example.com", run again with the --allow-net flag | ||
at https://localhost:4545/workers/static_remote.ts:2:8 | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[WILDCARD]error: Uncaught (in worker "bar") Error: foo[WILDCARD] | ||
at foo ([WILDCARD]) | ||
at [WILDCARD] | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
4 changes: 2 additions & 2 deletions
4
cli/tests/testdata/workers/worker_message_handler_error.ts.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
error: Uncaught (in worker "foo") (in promise) Error: bar | ||
error: Uncaught (in worker "foo") Error: bar | ||
throw new Error("bar"); | ||
^ | ||
at onmessage ([WILDCARD]/message_handler_error.ts:[WILDCARD]) | ||
at [WILDCARD] | ||
error: Uncaught (in promise) Error: Unhandled error event in child worker. | ||
error: Uncaught (in promise) Error: Unhandled error in child worker. | ||
at Worker.#pollControl ([WILDCARD]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.