We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48be669 commit 18a635eCopy full SHA for 18a635e
src/vm/js/nqp-runtime/io.js
@@ -281,9 +281,17 @@ function modeToFlags(mode) {
281
}
282
283
op.open = function(name, mode) {
284
- let fh = new FileHandle(fs.openSync(name, modeToFlags(mode)));
285
- fh.encoding = 'utf8';
286
- return fh;
+ try {
+ let fh = new FileHandle(fs.openSync(name, modeToFlags(mode)));
+ fh.encoding = 'utf8';
287
+ return fh;
288
+ } catch (e) {
289
+ if (e.code === 'ENOENT') {
290
+ throw new NQPException(`Failed to open file ${name}: No such file or director`);
291
+ } else {
292
+ throw e;
293
+ }
294
295
};
296
297
op.seekfh = function(ctx, fh, offset, whence) {
0 commit comments