mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
refactor: add and use libdeno.setGlobalErrorHandler instead of window.onerror
This commit is contained in:
parent
3a5cf9ca8b
commit
17d6d6b336
7 changed files with 88 additions and 56 deletions
|
@ -122,8 +122,8 @@ global.SnapshotBug = () => {
|
|||
assert("1,2,3" === String([1, 2, 3]));
|
||||
};
|
||||
|
||||
global.ErrorHandling = () => {
|
||||
global.onerror = (message, source, line, col, error) => {
|
||||
global.GlobalErrorHandling = () => {
|
||||
libdeno.setGlobalErrorHandler((message, source, line, col, error) => {
|
||||
libdeno.print(`line ${line} col ${col}`);
|
||||
assert("ReferenceError: notdefined is not defined" === message);
|
||||
assert(source === "helloworld.js");
|
||||
|
@ -131,10 +131,15 @@ global.ErrorHandling = () => {
|
|||
assert(col === 1);
|
||||
assert(error instanceof Error);
|
||||
libdeno.send(new Uint8Array([42]));
|
||||
};
|
||||
});
|
||||
eval("\n\n notdefined()\n//# sourceURL=helloworld.js");
|
||||
};
|
||||
|
||||
global.DoubleGlobalErrorHandlingFails = () => {
|
||||
libdeno.setGlobalErrorHandler((message, source, line, col, error) => {});
|
||||
libdeno.setGlobalErrorHandler((message, source, line, col, error) => {});
|
||||
};
|
||||
|
||||
global.SendNullAllocPtr = () => {
|
||||
libdeno.recv(msg => {
|
||||
assert(msg instanceof Uint8Array);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue