diff --git a/lib/fs.js b/lib/fs.js index a7b56ee86171e3..778eed95db6c7d 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -574,8 +574,12 @@ function openAsBlob(path, options = kEmptyObject) { // The underlying implementation here returns the Blob synchronously for now. // To give ourselves flexibility to maybe return the Blob asynchronously, // this API returns a Promise. - path = getValidatedPath(path); - return PromiseResolve(createBlobFromFilePath(path, { type })); + try { + path = getValidatedPath(path); + return PromiseResolve(createBlobFromFilePath(path, { type })); + } catch (error) { + return Promise.reject(error); + } } /**