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
isPromiseFs fails on Deno #1851
Comments
Do you want to contribute and create a fix? As for the catch in Deno, maybe this should reported as a bug for Deno. Errors should not escape catch unless the error is retrown. |
I would definitely be open to contributing a fix. I've also reported a bug against Deno (denoland/deno#21795), and will see what they say there first. It definitely seems like a bug, even if it's really weird to call |
@jcubic Thinking about this, is there a reason it needs to check that Alternatively, would it work to provide a way to say “this one is really a promise-based api, trust me”? |
The problem is that the library expects to detect if it's normal FS or promisified FS. If it's normal FS it promisify all the functions from FS. So yes it needs to check if the result is fs.promise or not. But maybe it can check different method that don't throw an error. I'm wondering if |
You can also report this bug to Deno. Exceptions should not bypass |
It's being discussed over at Deno, and this comment gets to what's happening here: denoland/deno#21795 (comment). I think there's a decent case to be made either way — it looks like an emergent property of JavaScript's defaulting behavior, the fact that |
Deno folks are also working on a patch: denoland/deno#22030 |
You can contribute with a fix. Maybe using an empty string will look better than passing undefined. I'm not sure how Deno will work for that case. |
I have confirmed that denoland/deno#22030 fixes this on the Deno side, so the next Deno release (due tomorrow) should work. |
When attempting to run in Deno (with
node:fs
as the fs), attempting a git operation fails with the following error:When I can get a full stack trace, this is appearing through
isPromiseLike()
. Testing at the Deno REPL indicates that error whenreadFile()
is called without arguments is escaping thecatch
clause. I am not sure what would be causing this on the Deno end, but REPL testing indicate that explicitly passing an empty string argument toreadFile()
would probably correct the problem.The text was updated successfully, but these errors were encountered: