fileOpen() function doesn't reject promise when user dismiss file picker prompt without selecting a file
See original GitHub issueThe API works fine when selecting files and also handles rejection when the chosen file is not valid, but when the user dismiss the file picker prompt without selecting any file, execution gets stuck in await fileOpen().
Code sample:
let fileHandle;
try {
fileHandle = await fileOpen({
mimeTypes: ['text/csv'],
extensions: ['.csv'],
});
} catch(error) {
console.log(error); // Nothing happens here
}
AC: Reject promise in fileOpen function when file picker prompt is dismissed
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Cancel event on input type="file" - javascript - Stack Overflow
Scenario 1 : When the select file is clicked and then cancel is clicked ... prompted the dialog to close */ event: Event...
Read more >Window.showOpenFilePicker() - Web APIs - MDN Web Docs
An AbortError is thrown if a user dismisses the prompt without making a selection or if a file selected is deemed too sensitive...
Read more >Error handling with promises - The Modern JavaScript Tutorial
Here's an example: new Promise((resolve, reject) => { resolve("ok"); }). then((result) => { throw new Error("Whoops!"); // rejects the promise ...
Read more >How To Use Multithreading in Node.js - DigitalOcean
Node.js runs JavaScript code in a single thread, which means your code can do one task at a time and can't use multiple...
Read more >Node.js v19.3.0 Documentation
If the function does not return a promise, assert.doesNotReject() will return a rejected Promise with an ERR_INVALID_RETURN_VALUE error. In both cases the error ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Safari Web Inspector:
@mikeAtHexosIp Thanks again for reporting this. I have just release
v0.14.0
that includes this fix.