iotjs icon indicating copy to clipboard operation
iotjs copied to clipboard

No error or warning when given invalid file

Open seanshpark opened this issue 11 years ago • 6 comments

Run iotjs with invalid file name, some random string. I think it should show some error or waring that file does not exist on invalid file. Currently it shows nothing. Test with 1777b853605852f27f6fca2eb61c2f2236241b11

seanshpark avatar Jun 11 '15 22:06 seanshpark

This is not bug. remove bug tag, attach enhancement

ILyoan avatar Jun 12 '15 01:06 ILyoan

in module.js

Module.load = function(id, parent, isMain) {
  if(process.native_sources[id]){
    return Native.require(id);
  }
  var module = new Module(id, parent);

  var modPath = Module.resolveModPath(module.id, module.parent);


  if(modPath) {
    module.filename = modPath;
    module.SetModuleDirs(modPath);
    module.compile();
  }

  return module.exports;
};

in case of no file exisit, module.resolvemodPath() returns false and Module.load returned doing nothing. we can raise an exception here when modPath is false.

ILyoan avatar Jun 12 '15 02:06 ILyoan

node.js throws Error in this case.

ILyoan avatar Jun 12 '15 05:06 ILyoan

#86 resolved this issue.

chunseoklee avatar Jun 12 '15 07:06 chunseoklee

Closing as #86 landed

ILyoan avatar Jun 15 '15 05:06 ILyoan

We can report error after #87, before that just abort.

ILyoan avatar Jun 15 '15 05:06 ILyoan