Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e.preventDefault() on unhandledrejection/error events doesn't work #19334

Closed
jespertheend opened this issue May 31, 2023 · 3 comments
Closed

Comments

@jespertheend
Copy link
Contributor

When I saw that #16928 was fixed I wanted to try it out for my use case, but it seems like I can still reproduce it under certain conditions. Specifically when importing std/node/process.ts.

import "https://deno.land/[email protected]/node/process.ts";
import {delay} from "std/async/delay.ts";

/**
 * @typedef FailedTestsData
 * @property {string} path
 * @property {string[]} failedTestNames
 */

globalThis.addEventListener("unhandledrejection", e => {
	console.log("unhandled!");
	e.preventDefault();
});
globalThis.addEventListener("error", e => {
	console.log("caught!");
	e.preventDefault();
});

(async () => {
    throw 'failed';
})();

await delay(5_000);

console.log("done");
@jespertheend
Copy link
Contributor Author

jespertheend commented May 31, 2023

Ah hmm, seems like this issue is exactly what was fixed in #19235, I'm simply importing an old std version which still has this issue.
Unfortunately third party code is importing this version, so there's not a lot I can do :/

@bartlomieju
Copy link
Member

@jespertheend yeah, there's not much we can do with old version of deno_std. The issue at hand is fixed when using node:process import, but I won't be able to fix it for old code.

@jespertheend
Copy link
Contributor Author

Yeah makes sense, sorry I thought I closed this.
I have forked deno-puppeteer and manually replaced https://esm.sh/[email protected] with npm:[email protected].
Seems to work so far.

@jespertheend jespertheend closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants