`openAsBlob` fails synchronously
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v24.14.0
Platform
Linux vali 6.18.7-76061807-generic #202601231045~1769703228~24.04~cb87b5b SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux
Subsystem
fs
What steps will reproduce the bug?
import { openAsBlob } from 'node:fs'
const result = await openAsBlob('does-not-exist').catch((error) => {})
console.log(result)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
I expect openAsBlob() to always return a promise. If there are any problems, I expect the promise to be rejected.
What do you see instead?
Instead of returning a promise that’s rejected, openAsBlob() fails synchronously. This means that instead of using the Promise.catch() method, you have to use try/catch logic instead.
Additional information
Just marking the function as async on https://github.com/nodejs/node/blob/v25.8.1/lib/fs.js#L570 would fix it.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in lib/fs.js in der Nähe der openAsBlob()-Implementierung an der referenzierten Zeile und reproduziere den Fehler mit dem bereitgestellten Beispiel für einen fehlenden Pfad. Prüfe die umgebenden fs-Tests oder füge eine Abdeckung für den Fehlerfall hinzu. Die Aufgabe ist erledigt, wenn openAsBlob() ein Promise zurückgibt und der fehlende Pfad durch eine Promise-Ablehnung statt durch einen synchronen Wurf gemeldet wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 78/100